Description Usage Arguments Details Author(s) References Examples
View source: R/SlidingWindow.R
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.
1 | SlidingWindow(FUN, data, window, step)
|
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. |
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.
Heath Blackmon
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)
|
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.