Skip to content
Prev 138805 / 398506 Next

can't merge zoo ojects and convert to ts (been trying for 2 days)

Its a bug in na.approx.  I just fixed it and (1) until a
new version of zoo comes out add this to your code:

source("http://r-forge.r-project.org/plugins/scmsvn/viewcvs.php/*checkout*/pkg/R/na.approx.R?rev=448&root=zoo")

or (2) a workaround not requiring that source statement
is to add the na.rm = FALSE argument to
na.approx since the bug only gets triggered with the
default na.rm = TRUE setting.

Actually in your case you don't need na.approx anyways
since as.ts can do it all itself and if you want to force
a specific frequency (rather than the one it picks) you
can convert to zooreg first specifying that frequency.

Also please try to provide code in such a manner that
one can simply copy it from the post and paste it into
one's R session to reproduce the problem using the
style shown below.  I have also illustrated some
simplifications:

library(zoo)
library(chron)

la_time_test2 <- "TRIP_ID,Ruta_datetime_start,Minutos de viaje
28/04/2004_CM2-CM1_downriver_08:15,28/04/2004 08:15,125
28/04/2004_CM1-CM2_upriver_13:05,28/04/2004 13:05,295
"

t.df <- read.csv(textConnection(la_time_test2))
t.zoo <- zoo(test2.df[,3], as.chron(strptime(test2.df[,2], "%d/%m/%Y %H:%M")))
t.ts <- as.ts(as.zooreg(test2.zoo, freq = 24 * 365))
On Thu, Mar 6, 2008 at 5:00 PM, Darren Norris <doon75 at hotmail.com> wrote: