[R] aggregating a daily zoo object to a weekly zoo object

Erin Hodgess erinm.hodgess at gmail.com
Mon Aug 2 00:06:11 CEST 2010


Dear R People:

I'm trying to convert a daily zoo object to a weekly zoo object:


 xdate <- seq(as.Date("2002-01-01"),as.Date("2010-07-10"),by="day")
 library(zoo)
 length(xdate)
xt <- zoo(rnorm(3113),order=xdate)
xdat2 <- seq(index(xt)[1],index(xt)[3113],by="week")
 xt.w <- aggregate(xt,by=xdat2,mean)
Error: length(time(x)) == length(by[[1]]) is not TRUE
 aggregate(xt,by="week",mean)
Error: length(time(x)) == length(by[[1]]) is not TRUE



I'm not sure what is going wrong.  Any help would be much appreciated.

Thanks,
Erin


-- 
Erin Hodgess
Associate Professor
Department of Computer and Mathematical Sciences
University of Houston - Downtown
mailto: erinm.hodgess at gmail.com



More information about the R-help mailing list