Suppose I have a dataframe beginning:

id  yr   val
a  1950   1
b  1950   10
a  1951   2

I'm trying to produce a table of cumulative sums
of val, disaggregated by id and then yr, so the result
should begin

id yr   cumval
a  1950  1
a  1951  3
b  1950  10

I've been trying to do this using "aggregate"
and passing the function "cumsum," but I can't get
it to work. Can someone tell me how to do this?
Thanks!


------------------------
Philip A. Viton
City Planning, Ohio State University
275 West Woodruff Avenue, Columbus OH 43210
vito...@osu.edu

______________________________________________
R-help@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.

Reply via email to