[R] accumulate vector data

Duncan Murdoch murdoch.duncan at gmail.com
Fri Oct 7 14:14:31 CEST 2011


On 11-10-07 6:55 AM, Karl Weinmayer wrote:
> Hi,
>
>
>
> What is the best way to accumulate the entries in a vector. For example,
>
>
>
> a<- c(1,2,3,4,5)
>
>
>
> And I want to have
>
>
>
> b<- c(1,3,6,10,15)

cumsum(a)

Duncan Murdoch



More information about the R-help mailing list