Learn R Programming

weaana (version 0.3.0)

mov: Calculate the moving values

Description

Calculate the moving values

Usage

mov(x, k = 10, shift = "centre", fun = "mean")

Value

The moving value of vector x at moving windows k. A NULL will be returned for any unsupported fun

Arguments

x

A vector to calculate moving values

k

The moving windows

shift

if shift = "centre", then values are shifted to centre. if shift = "begin", then values are at begin of period. if shift = "end", then values are at end of period. The default value (centre) will be used if shift is other value.

fun

The method to calculate moving values. Curruntly, only "mean", "max", "min", and "sum" are supported. A NULL will be returned for any other values