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)

}

Try the SwathXtend package in your browser

Any scripts or data that you put into this service are public.

SwathXtend documentation built on Nov. 8, 2020, 6:42 p.m.