rollvec | R Documentation |
Summarize a vector in rolling windows.
rollvec(x, width, stat = "sum", prob = 0.5)
x |
A numeric vector. |
width |
The width of the rolling window. Must be odd. |
stat |
The statistic used to summarize the values in each bin. Must be one of "sum", "mean", "max", "min", "sd", "var", "mad", or "quantile". |
prob |
The quantile for |
An numeric vector with the same length as x
with the summarized values from each rolling window.
Kylie A. Bemis
set.seed(1)
x <- sort(runif(20))
rollvec(x, 5L, "mean")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.