simple_moving_average: Function to apply rolling mean to a vector.

View source: R/simple_moving_average.R

simple_moving_averageR Documentation

Function to apply rolling mean to a vector.

Description

Function to apply rolling mean to a vector.

Usage

simple_moving_average(x, width, align = "center", na.rm = TRUE)

Arguments

x

Numeric vector. The order of x should be checked to ensure behaviour is as expected.

width

Width of margin to apply function.

align

Should the index of the result be centered, left- or right-aligned? Default is "center".

na.rm

Should NAs be removed for the aggregation. Default is TRUE, but setting to FALSE will be faster.

Author(s)

Stuart K. Grange

See Also

mean, rollmean


skgrange/threadr documentation built on May 11, 2024, 12:16 p.m.