ma: MA

View source: R/transformations.R

maR Documentation

MA

Description

Moving Average

Usage

ma(v, width, align = "center", zero = TRUE)

Arguments

v

Numeric vector

width

Width of moving average window as an integer, v

align

Either string "center", "left", or "right"

zero

Boolean to determine the NAs generated by the moving average should be filled with zeros or with the vector's mean.

Details

Applies a moving average on the input vector. The type of moving average is defined by the argument align.

Value

The modified vector v

Examples

ma(c(1,0,0,0,1,0,0,0,2), 3)
ma(c(1,0,0,0,1,0,0,0,2), 3, align = "right")
ma(c(1,0,0,0,1,0,0,0,2), 3, zero = FALSE)

linea documentation built on Sept. 15, 2022, 9:06 a.m.

Related to ma in linea...