cumsum package:base R Documentation _C_u_m_u_l_a_t_i_v_e _S_u_m_s, _P_r_o_d_u_c_t_s, _a_n_d _E_x_t_r_e_m_e_s _D_e_s_c_r_i_p_t_i_o_n: Returns a vector whose elements are the cumulative sums, products, minima or maxima of the elements of the argument. _U_s_a_g_e: cumsum(x) cumprod(x) cummax(x) cummin(x) _A_r_g_u_m_e_n_t_s: x: a numeric or complex (not 'cummin' or 'cummax') object, or an object that can be coerced to one of these. _D_e_t_a_i_l_s: These are generic functions: methods can be defined for them individually or via the 'Math' group generic. _V_a_l_u_e: 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. An '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). _S_4 _m_e_t_h_o_d_s: 'cumsum' and 'cumprod' are S4 generic functions: methods can be defined for them individually or via the 'Math' group generic. 'cummax' and 'cummin' are individually S4 generic functions. _R_e_f_e_r_e_n_c_e_s: Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) _The New S Language_. Wadsworth & Brooks/Cole. ('cumsum' only.) _E_x_a_m_p_l_e_s: cumsum(1:10) cumprod(1:10) cummin(c(3:1, 2:0, 4:2)) cummax(c(3:1, 2:0, 4:2))