roll {RHRT}R Documentation

Apply method on sliding window

Description

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

Usage

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


[Package RHRT version 1.0.1 Index]