runstat {IRanges} | R Documentation |
The runsum
, runmean
, runwtsum
, runq
functions
calculate the sum, mean, weighted sum, and order statistics for fixed width
running windows.
runsum(x, k, endrule = c("drop", "constant")) runmean(x, k, endrule = c("drop", "constant")) runwtsum(x, k, wt, endrule = c("drop", "constant")) runq(x, k, i, endrule = c("drop", "constant"))
x |
The data object. |
k |
An integer indicating the fixed width of the running window. Must be
odd when endrule == "constant" .
|
wt |
A numeric vector of length k that provides the weights to use.
|
i |
An integer indicating which order statistic to calculate. |
endrule |
A character string indicating how the values at the beginning
and the end (of the data) should be treated.
|
The runsum
, runmean
, runwtsum
, and runq
functions provide efficient methods for calculating the specified
numeric summary by performing the looping in compiled code.
An object of the same class as x
.
P. Aboyoun
runmed
, Rle-class, RleList-class
x <- Rle(1:10, 1:10) runsum(x, k = 3) runsum(x, k = 3, endrule = "constant") runmean(x, k = 3) runwtsum(x, k = 3, wt = c(0.25, 0.5, 0.25)) runq(x, k = 5, i = 3, endrule = "constant")