runningmean | R Documentation |
Calculates a running mean, sum or median with a specified window.
runningmean( pos, value, at = NULL, window = 1000, what = c("mean", "sum", "median", "sd") )
pos |
Positions for the values. |
value |
Values for which the running mean/sum/median/sd is to be applied. |
at |
Positions at which running mean (or sum or median or sd) is
calculated. If NULL, |
window |
Window width. |
what |
Statistic to use. |
A vector with the same length as the input at
(or pos
,
if at
is NULL), containing the running
statistic.
Karl W Broman broman@wisc.edu
runningratio()
x <- 1:10000 y <- rnorm(length(x)) plot(x,y, xaxs="i", yaxs="i") lines(x, runningmean(x, y, window=100, what="mean"), col="blue", lwd=2) lines(x, runningmean(x, y, window=100, what="median"), col="red", lwd=2) lines(x, runningmean(x, y, window=100, what="sd"), col="green", lwd=2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.