View source: R/variance_functions.R
runmean | R Documentation |
errbar
is a function that allows the calculation of smoothed running
means for a numeric vector. It uses the rollmean
function
from the package zoo
to compute rolling means for the numeric
vector and then the smoothEnds
function from the package
stats
to smooth the end points of the resulting vector.
runmean(x, window, align = "center")
x |
numeric vector representing a series of observations. |
window |
integer width of the rolling window. |
align |
character specifying whether the index of the result should be left- or right-aligned or centered (default) compared to the rolling window of observations. |
An object of the same class as x with the rolling mean with smoothed ends.
rollmean
, smoothEnds
.
set.seed(1234) x <- seq(1, 50, 1) y <- (2 + 2 * x) * rnorm(50, 1, 0.2) runmean(x = y, window=3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.