cummean | R Documentation |
Returns a vector whose elements are the cumulative means of the argument.
cummean(x)
x |
A numeric object. |
A vector of the same length and type as x
(after coercion).
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 (with
a warning).
x <- 1:10 cummean(x) cumsum(x) / seq_along(x) # equivalent using cumulative sums
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.