x <- 1:10000
y <- rnorm(length(x))
plot(x,y, xaxs="i", yaxs="i")
lines(x, runningmean(x, y, window=100, what="mean"),
col=crayons("Blue"), lwd=2)
lines(x, runningmean(x, y, window=100, what="median"),
col=crayons("Red"), lwd=2)
lines(x, runningmean(x, y, window=100, what="sd"),
col=crayons("Green"), lwd=2)
Run the code above in your browser using DataLab