convert a matrix to a list

mat2list(x)

Arguments

x

the input matrix

Value

a list that contains matrix columns as its elements

Examples

x <- matrix(1:15, nrow = 3)
mat2list(x)
#> [[1]]
#> [1] 1 2 3
#> 
#> [[2]]
#> [1] 4 5 6
#> 
#> [[3]]
#> [1] 7 8 9
#> 
#> [[4]]
#> [1] 10 11 12
#> 
#> [[5]]
#> [1] 13 14 15
#>