evobiR (version 1.1)

SlidingWindow: Sliding window analysis

Description

Applies a function within a sliding window of a numeric vector. Both the step size and the window size can be set by the user.

Usage

SlidingWindow(FUN, data, window, step)

Arguments

FUN
a function to be applied within each window.
data
a numerical vector.
window
an integer setting the size of the window.
step
an integer setting the size of step between windows.

Details

Returns a vector of numeric values representing the applying the selected function within each window. The length will be unequal to the original data and will be determined primarily by the step size.

References

http://coleoguy.github.io/

Examples

Run this code
data <- c(1,2,1,2,10,2,1,2,1,2,3,4,5,6,2,5)
SlidingWindow("mean", data, 3, 1)

Run the code above in your browser using DataLab