runningmean: Running mean, sum, or median

Description Usage Arguments Value Author(s) Examples

Description

Calculates a running mean, sum or median with a specified window.

Usage

1
2
runningmean(pos, value, at, window = 1000, what = c("mean", "sum", "median",
  "sd"))

Arguments

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 missing, pos is used.

window

Window width.

what

Statistic to use.

Value

A vector with the same length as the input at (or pos, if at is missing), containing the running statistic.

Author(s)

Karl W Broman kbroman@biostat.wisc.edu

Examples

1
2
3
4
5
6
7
8
9
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)

patr1ckm/patr1ckm documentation built on May 24, 2019, 8:21 p.m.