runMean | R Documentation |
Calculate a running mean from a numeric vector.
runMean(x, n, edge = "NA")
x |
numeric vector to smooth. |
n |
the size of the window in which to smooth. |
edge |
How to treat edge cases where a full window is unavailable. Current options are 'NA' to fill with NAs or 'fill' to fill with original values |
A numeric vector of smoothed values.
x <- rnorm(1000)
y <- c(1:1000)
plot(y,x, type="l")
lines(runMean(x,50), col="red")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.