Solved – R unfold a list into a matrix

covariance-matrixmatrixr

I have a list in which each element inside it is a matrix. How can I unfold this list to get a matrix.
Example:
List[[1]]=matrix A
List[[2]]=matrix B
List[[3]]=matrix C
and I want directly to get a matrix of
A,0,0
A,B,0
0,0,C
Note that I would like to do this for a large matrix

Best Answer

try this :

output <- matrix(unlist(List), ncol, byrow = TRUE)

Related Question