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)
These are generic functions: methods can be defined for them individually or via the
Math group generic.
A vector of the same length and type as
x (after coercion), except that
cumprod returns a numeric vector for integer input (for consistency with
*). Names are preserved.
NA value in
x causes the corresponding and following elements of the return value to be
NA, as does integer overflow in
cumsum (with a warning).
Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New S Language. Wadsworth & Brooks/Cole. (
Documentation reproduced from R 3.0.2. License: GPL-2.