Description Usage Arguments Author(s) Examples
View source: R/src_AverageBy.R
Function takes a named list with column numbers to be averaged. Unpaired columns are simply returned as-is.
1 |
cts |
a numeric matrix or data.frame |
by |
a named list with column numbers to be averaged, colname will be the respective list name |
Alexander Toenges
1 2 3 4 5 | cts <- lapply(seq(1,5), function(x) rnorm(10)) %>% do.call(cbind, .)
colnames(cts) <- c("A_rep1", "B_rep1", "A_rep2", "C_rep1", "B_rep2")
rownames(cts) <- paste0("Gene", seq(1,nrow(cts)))
by <- sapply(unique(gsub("_rep.*", "", colnames(cts))), function(x) grep(paste0("^", x, "_rep"), colnames(cts)))
AverageBy(cts,by)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.