> cumsum(c(2,1,4,5)) [1] 2 3 7 12
On Wed, Oct 5, 2011 at 10:06 AM, behave <dethl...@hotmail.com> wrote: > dear R-Community > > is there a function which sums data "stepwise" > > exp: > > 2 > 1 > 4 > 5 > > Desired result > > 2 = 2 > 2+1 = 3 > 2+1+4 = 7 > 2+1+4+5 = 12 > > Is there a built in function for this? > > Thx > Dom > -- Sarah Goslee http://www.functionaldiversity.org ______________________________________________ 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.