m = matrix(1:10,nrow=2, ncol=2)
print("Original matrix:")
print(m)
l = split(m, rep(1:ncol(m), each = nrow(m)))
print("list from the said matrix:")
print(l)
Sample Output:
[1] "Original matrix:"
[,1] [,2]
[1,] 1 3
[2,] 2 4
[1] "list from the said matrix:"
$`1`
[1] 1 2
$`2`
[1] 3 4
Sample Output:
[1] "Original matrix:" [,1] [,2] [1,] 1 3 [2,] 2 4 [1] "list from the said matrix:" $`1` [1] 1 2 $`2` [1] 3 4need an explanation for this answer? contact us directly to get an explanation for this answer