I would like to smooth a time curve, that I have plotted, by applying a loess function, but I can’t get it to work.
An example:
mydat <- runif(50)
day1 <- as.POSIXct("2012-07-13", tz = "UTC")
day2 <- day1 + 49*3600*24
pdays <- seq(day1, day2, by = "days")
lo <- loess(mydat ~ pdays)
I get the following message:
Error: NA/NaN/Inf in foreign function call (arg 2)
Is it possible to apply a loess smoothing to a time series
Any help or guidance is greatly appreciated!
I think the idea here is to convert your time series in a numerical form (using
as.numeric) so you can perform the operation.