Re: [R] Sum per hour

From: <jessica.gervais_at_tudor.lu>
Date: Tue, 29 May 2007 09:55:44 +0200

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



R-help_at_stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Tue 29 May 2007 - 07:59:00 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 29 May 2007 - 10:31:19 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.