I am sure there is a more sophisticated way, but I would do it like this:
hourindex <- round(as.numeric(YYMMDDHHmm)/100,digits=0)
hourly.means <- aggregate(dataset,hourindex,mean)
For aggregate you just need an index with the length of the amount of
rows that your dataset has, that assigns a u
This calculates hourly means:
> aggregate(z, trunc(time(z), "01:00:00"), mean)
Precip mphDeg DegF Fuel Rel volts DegMx
mphgust wm
(06/01/06 00:00:00) 0 2.375 97.625 40.8 NA 37.00833NANA
2.708333 0.3
(06/01/06 01:00:00) 0 1.800 97.700 38.6 NA 3
Hi All-
I have been trying to separate data into columns - specifically the
date - and then aggregate the rest of the data to calculate summer
hourly means. However, now I would like to calculate hourly means just
over one day at a time. And, I am not able to figure out how to do
this. I rea
3 matches
Mail list logo