SlidingWindow: Sliding window analysis

Description Usage Arguments Details Author(s) References Examples

Description

Applies a function within a sliding window of a numeric vector or matrix. Both the step size and the window size can be set by the user. For the matrix impelentation the step size and window size is constrained to be the same in both the X and Y dimensions.

Usage

1
SlidingWindow(FUN, data, window, step, strict)

Arguments

FUN

a function to be applied within each window.

data

a numerical vector or matrix

window

an integer setting the size of the window

step

an integer setting the size of step between windows

strict

TRUE or FALSE indicating whether validation testing should be performed

Details

If the input data is a vector then returns a vector of numeric values representing the application of the selected function within each window. If the input data is a matrix then returns a matrix of numeric values representing the application fo the selected function within each window.

Author(s)

Heath Blackmon

References

http://coleoguy.github.io/

Examples

1
2
3
4
5
6
7
# vector example
x1 <- rnorm(100, sd=3)
z1 <- SlidingWindow(FUN="mean", data=x2, window=10, step=5, strict=T)

# matrix example
x2 <- matrix(rnorm(10000),100,100)
z2 <- SlidingWindow(FUN="mean", data=x1, window=10, step=5, strict=T)

coleoguy/evobir documentation built on June 13, 2019, 9:54 p.m.