On Thu, Feb 17, 2011 at 3:39 PM, Stephen Sefick <[email protected]> wrote:
> Janet:
>
> The zoo package and aggregate.zoo should do the trick. I have done this
> many times with these tools.
Here is some code. Suppose precip is the data. We convert it to a zoo
object with date/times assuming the first one is at the start of
2000-01-01. Then we aggregate them by day:
> library(zoo)
> library(chron)
> precip <- 1:200 # sample data
> z <- zooreg(precip, start = as.chron("2000-01-01 00:00:00"), freq = 96)
> z.ag <- aggregate(z, as.Date)
> z.ag
2000-01-01 2000-01-02 2000-01-03
4656 13872 1572
--
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com
______________________________________________
[email protected] 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.