moving_average: Smooth vector using moving averages

Description Usage Arguments Value

View source: R/util.R

Description

Smooth vector using moving averages

Usage

1
moving_average(x, n = 5, cyclic = TRUE)

Arguments

x

- the vector to smooth

n

- the number of points to use for smoothing. Must be odd.

cyclic

- logical indicating whether to treat the vector as cyclic

Value

A vector of centered averages of size n. If cyclic=TRUE, it is the same length as vector x and the last elements are averages of first and last elements (cyclical overflow).


Blaza/ssoftveR documentation built on May 6, 2019, 11:19 a.m.