MovingWindow {HelpersMG}R Documentation

Return a moving average of a vector.

Description

Return a moving average of a vector./cr hole parameter can be none, bothL, bothR, both, begin, end.

Usage

MovingWindow(x, window, hole = "begin", fill = TRUE, FUN = mean)

Arguments

x

The vector to analyze

window

The window size

hole

Should the returned vector have the same length than x

fill

TRUE or FALSE, should the vector return NA

FUN

Function to apply to the window

Details

MovingWindow returns a moving average of a vector.

Value

A vector

Author(s)

Marc Girondot marc.girondot@gmail.com

Examples

MovingWindow(1:10, window = 4, fill = TRUE, hole="bothL")
MovingWindow(1:10, window = 4, fill = TRUE, hole="bothR")
MovingWindow(1:10, window = 4, fill = TRUE, hole="both")
MovingWindow(1:10, window = 4, fill = TRUE, hole="none")
MovingWindow(1:10, window = 4, fill = TRUE, hole="begin")
MovingWindow(1:10, window = 4, fill = TRUE, hole="end")
MovingWindow(1:10, window = 4, fill = TRUE, hole="end", FUN=sd)

[Package HelpersMG version 6.1 Index]