[R] summing 15 minute precip data to daily
Gabor Grothendieck
ggrothendieck at gmail.com
Thu Feb 17 22:13:11 CET 2011
On Thu, Feb 17, 2011 at 3:39 PM, Stephen Sefick <ssefick at gmail.com> 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
More information about the R-help
mailing list