movav: Moving average

View source: R/movav.R

movavR Documentation

Moving average

Description

Compute the moving average of a vector.

Usage

movav(x, pkg = "native", mode = "centered", n = 5, na.rm = TRUE)

Arguments

x

a numeric vector.

pkg

string: "native" (default) or the name of a package with a function that computes moving averages. Besides "native", only "zoo" is allowed (zoo::rollapply will be used). respectively.

mode

String: "centered" (default) indicates that the moving average should be centered.

Details

The resulting moving average will be of order three.

Value

A vector with the moving average of the input.


SWS-Methodology/faoswsTrade documentation built on Feb. 13, 2023, 1:04 a.m.