cumsum {base} | R Documentation |
Returns a vector whose elements are the cumulative sums, products, minima or maxima of the elements of the argument.
cumsum(x) cumprod(x) cummax(x) cummin(x)
x |
a numeric object. |
An NA
value in x
causes the corresponding and following
elements of the return value to be NA
.
These are generic functions: methods can be defined for them
individually or via the Math
group generic.
Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988)
The New S Language.
Wadsworth & Brooks/Cole. (cumsum
only.)
cumsum(1:10) cumprod(1:10) cummin(c(3:1, 2:0, 4:2)) cummax(c(3:1, 2:0, 4:2))