rollmean: Rolling mean of a vector of values

View source: R/functions.R

rollmeanR Documentation

Rolling mean of a vector of values

Description

Computes the rolling mean of a vector of values x. I.e., the mean of a sliding window k values wide

Usage

rollmean(x, k)

Arguments

x

A vector of values.

k

Integer width of the rolling window.

Details

Equivalent function to the rollmean function in the zoo package, but much faster.

Value

A vector of rolling means

Examples

	x <- sample(1:1000000)
	k <- 10000
	rm <- rollmean(x,k)
	

AdrianTimpson/ADMUR documentation built on July 2, 2024, 8:39 p.m.