SlidingWindow: Sliding window analysis

Description Usage Arguments Details Author(s) References Examples

View source: R/SlidingWindow.R

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

1

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.

Author(s)

Heath Blackmon

References

http://coleoguy.github.io/

Examples

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

Example output

sh: 1: cannot create /dev/null: Permission denied
sh: 1: cannot create /dev/null: Permission denied
 [1] 1.333333 1.666667 4.333333 4.666667 4.333333 1.666667 1.333333 1.666667
 [9] 2.000000 3.000000 4.000000 5.000000 4.333333

evobiR documentation built on May 2, 2019, 5:40 a.m.