[R] Summing rows by years (each time separately)

Andrew Gaska crane243 at gmail.com
Mon Jan 9 15:06:35 CET 2012


Thanks for your answer!

There is one thing I could not find in aggregate():

 I want to have it a sum for each group of 2008,2009 and 2010. In
aggregate() I can sum all the rows that have a rowname 2008,  all the rows
that have a rowname 2009 and all the rows that have a rowname 2010.

But I want to have it summed separately each time a new group starts, so not
like this:

2008 24 20 16
2009 19 12 17
2010 16 19 13

but like this:

2008        15	12	10 
2009        9	3	7 
2010        10	14	10 
2008        9	8	6 
2009        10	9	10 
2010        6	5	3 


--
View this message in context: http://r.789695.n4.nabble.com/Summing-rows-by-years-each-time-separately-tp4276428p4278550.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list