I want to aggregate data by hourly mean. Daily is very easy:
apply.daily(X2,mean)
Why is there no function for hourly? I tried
hr.means <- aggregate(X2, format(X2["timestamp"],"%Y-%m-%d %H"))
and got always error with trim argument. Is there an easier function similar to apply.daily? What if I want to aggregate the mean of 5 minutes. Data are values per minute:
"timestamp", value
"2012-04-09 05:03:00",2
"2012-04-09 05:04:00",4
"2012-04-09 05:05:00",5
"2012-04-09 05:06:00",0
"2012-04-09 05:07:00",0
"2012-04-09 05:08:00",3
"2012-04-09 05:09:00",0
"2012-04-09 05:10:00",1
I am using xts and zoo.