Learn R Programming

GMCM (version 1.4)

cummean: Cumulative mean values

Description

Returns a vector whose i'th element is the cumulative mean (arithmetic mean) of the i'th first elements of the argument.

Usage

cummean(x)

Arguments

x

a numeric vector.

Value

A vector of length length(x) with the cumulative mean. The i'th entry cummean(x)[i] equals mean(x[1:i]).

See Also

cumsum

Examples

Run this code
# NOT RUN {
x <- sort(rnorm(100))
GMCM:::cummean(x)
# }

Run the code above in your browser using DataLab