Hi

I would like to aggregate a rainfall series with 1min records (timestamp and value of 0.1mm from a tipping bucket raingauge) to 10min values by summing up the values.

# ptime is a POSIXlt datetime value with tz="GMT"

t10min <- 600*floor(as.integer(as.POSIXct(data$ptime))/600)
w10min <- tapply(data$value, format(as.POSIXct(t10min, tz="GMT", origin = "1970-01-01"), "%Y-%m-%d %H:%M"), sum) write.table(as.matrix(w10min),"data 10min.txt", row.names=TRUE, col.names=FALSE, quote=FALSE)

This code works but I would like to have the result in datetime format of %m/%d/%Y %H:%M. When I output this format the records are not chronologically sorted but text-sorted because dimnames of w10min is of type character (because of the format function).
Is there an easier way summing up the records to 10min records?

Thanks,
Rolf

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.

Reply via email to