cumsum()

This function computes the cumulative sums of a numeric object.

x <- 1:10
cumsum(x)
##  [1]  1  3  6 10 15 21 28 36 45 55