Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

movingAverageByCol

Moving Average Smoother of Matrix Columns


Description

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

Usage

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

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

edgeR

Empirical Analysis of Digital Gene Expression Data in R

v3.32.1
GPL (>=2)
Authors
Yunshun Chen, Aaron TL Lun, Davis J McCarthy, Matthew E Ritchie, Belinda Phipson, Yifang Hu, Xiaobei Zhou, Mark D Robinson, Gordon K Smyth
Initial release
2021-01-14

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.