R/mlrGroup.R

Defines functions mlrGroup

Documented in mlrGroup

mlrGroup <-
function(mat, Group) {

Group = as.factor(Group)

if (length(Group) != ncol(mat)) stop("Matrix and group sizes don't match for mlr norm.");

lev.idx = lapply(levels(Group), FUN=function(g){which(Group == g)})

norm.list = lapply(lev.idx, FUN = function(i){mlrrep(mat[,i])});

# check same colnames?
norm.mat = matrix(NA, nrow(mat), ncol(mat))
colnames(norm.mat) = colnames(mat)
rownames(norm.mat) = rownames(mat)

for(j in 1:length(lev.idx)) norm.mat[,lev.idx[[j]]] = as.matrix(norm.list[[j]]$mat.norm)

mlrrep(norm.mat)

}
Bioconductor-mirror/SwathXtend documentation built on July 19, 2017, 8:41 a.m.