I have data of instantaneous water discharge under a file data.txt (data below)
(list) object can not be coerced to type 'double' I think the problem is due to the format of the dates, please how to solve this problem?
write.table(TAB4, file="Q.txt", sep=";",quote=FALSE,row.names=FALSE)
Two changes needed. The list
problem can be solved by converting x to POSIXct
, not POSIXlt
in section 6 of your code: x=as.POSIXct(TAB3$V1)
.
Then, in section 7, remove the NA
values from x and y: TAB4=approx(x[-z],y[-z], xout= x[z])
.
There is also a spurious p in pTAB4
in the following line that looks wrong.