Skip to contents

A function to return the cumulative mean of a vector.

Usage

cmean(.x)

Arguments

.x

A numeric vector

Value

A numeric vector

Details

A function to return the cumulative mean of a vector. It uses dplyr::cummean() as the basis of the function.

Author

Steven P. Sanderson II, MPH

Examples

x <- mtcars$mpg

cmean(x)
#>  [1] 21.00000 21.00000 21.60000 21.55000 20.98000 20.50000 19.61429 20.21250
#>  [9] 20.50000 20.37000 20.13636 19.82500 19.63077 19.31429 18.72000 18.20000
#> [17] 17.99412 18.79444 19.40526 20.13000 20.19524 19.98182 19.77391 19.50417
#> [25] 19.49200 19.79231 20.02222 20.39286 20.23448 20.21667 20.04839 20.09062