I have the following dataframe
And I want to replace the NA's with this vector (except it is class numeric for me, but I changed it to as.character() and still got the same error)
L8Replace <- c("0.56","0.57","0.87",0.81")
I have tried
mydata[is.na(mydata$Freq2),] <- L8replace
But get
Error in as.Date.numeric(value) : 'origin' must be supplied
I understand why R is confused, but I do not know how to fix it
For your use, this is what I get when I put my data though dput:
mydata <- structure(list(Freq2 = structure(c(0.42, 0.6, 0.43, NA, NA, NA,
NA, NA), .Names = c("2015-04-16", "2015-04-21", "2015-04-26",
"", "", "", "", "")), myDate = structure(c(16541, 16546, 16551,
16627, 16643, 16659, 16675, 16691), class = "Date"), numDays = structure(c(0,
5, 10, 86, 102, 118, 134, 150), class = "difftime", units = "days")), .Names = c("Freq2",
"myDate", "numDays"), row.names = c("2015-04-16", "2015-04-21",
"2015-04-26", "7", "8", "9", "10", "11"), class = "data.frame")