[R] cumsum function with data frame

From: <n.vialma_at_libero.it>
Date: Thu, 03 Jun 2010 17:58:37 +0200 (CEST)

Dear list,
I have a problem with the cumsum function. I have a data frame like the following one

variable        Year       value
EC01             2005         5

EC01             2006         10

AAO1            2005          2 

AAO1           2006          4
what I would like to obtain is
variable        Year       value   cumsum


EC01             2005         5           5


EC01             2006         10         15


AAO1            2005          2            2


AAO1           2006          4            6


if I use the by function or the aggregate function the result is a list or something else, what I want is a data frame as I showed above... anyone knows how to get it???
THANKS A LOT
        [[alternative HTML version deleted]]



R-help_at_r-project.org mailing list
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. Received on Thu 03 Jun 2010 - 16:03:38 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 03 Jun 2010 - 17:50:26 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive