movingFn: generic fn that computes the "fn" on a moving window

View source: R/aux_stats.R

movingFnR Documentation

generic fn that computes the "fn" on a moving window

Description

generic fn that computes the "fn" on a moving window

Usage

movingFn(x, fn = mean, period = length(x), direction = "forward")

Arguments

x

a numeric vector

fn

a function to be applied/computed, default is set to mean()

period

size of the "moving window", default set to the lenght of the vector

direction

type of moving avergage to consider: "forward", "centered", "backward"; ie. whether the window computation is ( "centered" / "forward" / "backward" ) wrt the data series

Value

a vector with the 'moving operation' applied to the x vector


covid19.analytics documentation built on Oct. 16, 2023, 1:06 a.m.