[R] Sum per hour
jessica.gervais at tudor.lu
jessica.gervais at tudor.lu
Tue May 29 09:55:44 CEST 2007
Thank you,
I have try your proposition.
Seems to be the right way... but I still have an error message.
Here is the code I have executing:
time<-c("2000-10-03 14:00:00","2000-10-03 14:10:00","2000-10-03
14:20:00","2000-10-03 15:30:00","2000-10-03 16:40:00","2000-10-03
16:50:00","2000-10-03 17:00:00","2000-10-03 17:10:00","2000-10-03
17:20:00","2000-10-03 18:30:00","2000-10-04 14:00:00","2000-10-04
14:10:00","2000-10-04 14:20:00","2000-10-04 15:30:00","2000-10-04
16:40:00","2000-10-04 16:50:00","2000-10-04 17:00:00","2000-10-04
17:10:00","2000-10-04 17:20:00","2000-10-04 18:30:00")
precipitation<-c(0,0.1,0,0,0,0,0.2,0.3,0.5,6,7,8,9,1,0,0,0,0,1,0)
library(zoo)
z <- zoo(precipitation, as.POSIXct(time, tz = "GMT"))
aggregate(z, function(x) as.POSIXct(trunc(x, "hour")), sum(na.rm=TRUE))
Error in FUN(X[[1L]], ...) : argument "INDEX" is missing, with no default
...
I saw you can index a zoo object. I have tried with a vector..but doesn't
work.
I don't know else what this INDEX argument is...
Does anyone have an idea about it ?
Thanks in advance,
Jessica
More information about the R-help
mailing list