Hi everyone,
I define discount rate variable as numeric. When i use this code
"a$DiscountRate<-as.numeric(a$DiscountRate)", null values turn into 3692 value. There are images below. How can i solve this problem. I tried to define null variables as 0.
this function does not work.
a$DiscountRate[is.null(a$DiscountRate)]=0
I tried to convers nulls into na by using this:
a$DiscountRate<-a$DiscountRate %>% replace(.=="NULL", NA)
a$DiscountRate[is.na(a$DiscountRate)]=0
After i define all null as 0 with this last operation, when i use this function:
a$DiscountRate<-as.numeric(a$DiscountRate)
It seems that your data begins life as a factor, and so its dangerous to cast with as.numeric probably need to convert to a character representation first.