[R] Different way of aggregating

skan juanpide at gmail.com
Thu Aug 19 01:43:47 CEST 2010


Hi


Usually "aggregate" is used to calculate things such as the sum of all data
on the first day, the sum next day, and so on.
But how can I calculate the mean of the first hour of all days, the mean of
the second hour of all days, and so on.  ???

That's 
Most examples:
today at 1am + today at 2am + today at 3am +....                    -> sum
today
tomorrow at 1am + tomorrow at 2am + tomorrow at 3am +....     -> sum
tomorrow
..................
aggregate(data, as.Date,sum)


But what I need is:
data today at 1 + data tomorrow at 1 + data in two days at 1 + .....    -> 
sum at 1am
data today at 2 + data tomorrow at 2 + data in two days at 2 + .....    -> 
sum at 2am
data today at 3 + data tomorrow at 3 + data in two days at 3 + .....    -> 
sum at 3am
.............

How can I do it??

cheers
-- 
View this message in context: http://r.789695.n4.nabble.com/Different-way-of-aggregating-tp2330497p2330497.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list