movingAverageByCol: Moving Average Smoother of Matrix Columns

Description Usage Arguments Details Value Author(s) Examples

View source: R/movingAverageByCol.R

Description

Apply a moving average smoother to the columns of a matrix.

Usage

1
movingAverageByCol(x, width=5, full.length=TRUE)

Arguments

x

numeric matrix

width

integer, width of window of rows to be averaged

full.length

logical value, should output have same number of rows as input?

Details

If full.length=TRUE, narrower windows are used at the start and end of each column to make a column of the same length as input. If FALSE, all values are averager of width input values, so the number of rows is less than input.

Value

Numeric matrix containing smoothed values. If full.length=TRUE, of same dimension as x. If full.length=FALSE, has width-1 fewer rows than x.

Author(s)

Gordon Smyth

Examples

1
2
x <- matrix(rpois(20,lambda=5),10,2)
movingAverageByCol(x,3)

Example output

Loading required package: limma
          [,1]     [,2]
 [1,] 7.500000 3.500000
 [2,] 7.333333 4.000000
 [3,] 6.333333 4.333333
 [4,] 6.000000 4.666667
 [5,] 5.333333 3.000000
 [6,] 5.333333 4.333333
 [7,] 5.666667 4.666667
 [8,] 4.666667 6.666667
 [9,] 5.666667 6.000000
[10,] 4.500000 6.000000

edgeR documentation built on Jan. 16, 2021, 2:03 a.m.