RollingApply: RollingApply

View source: R/RollingApply.R

RollingApplyR Documentation

RollingApply

Description

Applies a function to a centered rolling window of data. This is a simplified version of function rollaplly from package zoo.

Usage

RollingApply(data, width, func, ...)

Arguments

data

Vector of observations. Required.

width

Integer specifying the window width (in numbers of observations). Required.

func

Function to be applied. Required.

...

Additional arguments to be passed to func. Optional.

Examples

RollingApply(c(1, 2, 3, 4, 5), width = 3, func = sum)
RollingApply(c(1, 2, 3, 4, 5), width = 3, func = mean)
RollingApply(c(1, 2, 3, 4, 5), width = 3, func = sd)
RollingApply(c(1), width = 10, func = sd)
RollingApply(c(1), width = 10, func = mean)
RollingApply(c(), width = 10, func = sd)


nextpagesoft/hivEstimatesAccuracy documentation built on Sept. 17, 2024, 5 a.m.