Matrix to List of Matrix Columns

asColumnList(x)

Arguments

x

matrix

Value

list with as many elements as there are columns in x and each element representing one column

Examples

x <- matrix(1:12, nrow = 3) column_list <- asColumnList(x) for (i in 1:ncol(x)) print(identical(column_list[[i]], x[, i]))
#> [1] TRUE #> [1] TRUE #> [1] TRUE #> [1] TRUE