list2mat: List to Matrix

View source: R/utils.R

list2matR Documentation

List to Matrix

Description

List to Matrix

Usage

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

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

laurenhsu1/corral documentation built on Feb. 19, 2023, 10:37 p.m.