roll: Apply method on sliding window

Description Usage Arguments Details Value

View source: R/roll.R

Description

Applies a given function on a vector by rolling over it with a sliding window mechanism.

Usage

1
roll(intervals, width, fun, ...)

Arguments

intervals

vector

width

window size

fun

function to be applied

...

additional arguments for FUN

Details

This method was inspired by the function "wapply" by A. N. Spiess, University Hospital Hamburg-Eppendorf (https://rmazing.wordpress.com/2013/04/23/wapply-a-faster-but-less-functional-rollapply-for-vector-setups/), but adjusted for this package to speed it up.

Value

(list) List with return values of fun for each window


RHRT documentation built on June 29, 2021, 9:06 a.m.