cummean: Cumulative means

View source: R/cummean.R

cummeanR Documentation

Cumulative means

Description

Returns a vector whose elements are the cumulative means of the argument.

Usage

cummean(x)

Arguments

x

A numeric object.

Value

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).

Examples

x <- 1:10
cummean(x)
cumsum(x) / seq_along(x)  # equivalent using cumulative sums

bgreenwell/treemisc documentation built on Oct. 26, 2022, 12:56 a.m.