average.rows: Average rows by match and index

Description Usage Arguments Details Value Author(s) Examples

Description

average.rows matches rownames of a matrix to a match vector and performs averaging of the rows by the index provided by an index vector.

Usage

1
average.rows(x, index, match, r = 0.7)

Arguments

x

a matrix

index

index vector indicating how rows must be averaged

match

match vector for indexing rows

r

minimal correlation value between rows to compute average

Details

rows will be averaged only if the pearson correlation coefficient between all rows of each given index is greater than r. If not, that group of rows is discarded in the result matrix.

Value

a matrix of averaged rows

Author(s)

Ana Conesa and Maria Jose Nueda, mj.nueda@ua.es

Examples

1
2
3
4
5
6
## create data matrix for row averaging
x <- matrix(rnorm(30), nrow = 6,ncol = 5)
rownames(x) <- paste("ID", c(1, 2, 11, 12, 19, 20), sep = "")
i <- paste("g", rep(c(1:10), each = 2), sep = "")  # index vector
m <- paste("ID", c(1:20), sep = "")  # match vector
average.rows(x, i, m, r = 0)

mjnueda/maSigPro documentation built on Dec. 11, 2020, 12:21 a.m.