R/cummean.R

Defines functions cummean

Documented in cummean

#' @title Cumulative mean
#' @description Returns a vector whose elements are the cumulative mean of the elements of the argument.
#' @param x a numeric or complex object,
#'  or an object that can be coerced to one of these.
#' @return A numeric vector
#' @examples
#' cummean(1:10)
#'
#' @export

cummean = function(x) cumsum(x)/seq_along(x)

Try the tidyft package in your browser

Any scripts or data that you put into this service are public.

tidyft documentation built on Jan. 9, 2023, 1:27 a.m.