list2mat: List to Matrix

Description Usage Arguments Value Examples

View source: R/utils.R

Description

List to Matrix

Usage

1
list2mat(matlist, direction = c("c", "r")[1])

Arguments

matlist

list of matrices to concatenate

direction

character, r or c, to indicate whether should be row-wise (i.e., rbind to match on columns) or column-wise (i.e., cbind to match on rows). Defaults to columnwise (matching on rows) to match convention of SingleCellExperiments

Value

matrix

Examples

1
2
3
4
5
listofmats <- list(matrix(sample(seq(0,20,1),100,replace = TRUE),nrow = 10),
                   matrix(sample(seq(0,20,1),1000,replace = TRUE),nrow = 10))
newmat <- list2mat(listofmats) # to "cbind" them
listofmats_t <- lapply(listofmats,t)
newmat_t <- list2mat(listofmats_t, 'r') # to "rbind" them

corral documentation built on Nov. 8, 2020, 8:25 p.m.