[R] "stepwise" sum

Nordlund, Dan (DSHS/RDA) NordlDJ at dshs.wa.gov
Wed Oct 5 21:15:12 CEST 2011


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of behave
> Sent: Wednesday, October 05, 2011 7:07 AM
> To: r-help at r-project.org
> Subject: [R] "stepwise" sum
> 
> 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
> 
> 

?cumsum


Hope this is helpful,

Dan

Daniel J. Nordlund
Washington State Department of Social and Health Services
Planning, Performance, and Accountability
Research and Data Analysis Division
Olympia, WA 98504-5204




More information about the R-help mailing list