powered by
Returns a vector whose elements are the cumulative means of the argument.
cummean(x)
A vector of the same length and type as x (after coercion). Names are preserved.
x
An NA value in x causes the corresponding and following elements of the return value to be NA, as does integer overflow (with a warning).
NA
A numeric object.
x <- 1:10 cummean(x) cumsum(x) / seq_along(x) # equivalent using cumulative sums
Run the code above in your browser using DataLab