avgFacLvls: Average levels of a factor in a data matrix
Description
avgFacLvls takes a matrix and calculates the column means for each level of each factor given. It then replaces the original matrix rows with the means corresponding to the factor/level memership of a particular sample (row).
Usage
avgFacLvls(matrix, fac)
Arguments
matrix
A matrix.
fac
A vector of character strings with length = nrow(matrix)
Value
A matrix whose rows are composed of the column means for each level of the factor.