0
$\begingroup$

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

$\endgroup$
2
  • $\begingroup$ 'How to do _____ in R' questions are off topic here. Also, I don't follow your example. If you can clarify it, we can migrate this to Stack Overflow where it can be answered. $\endgroup$ Mar 8, 2016 at 22:14
  • $\begingroup$ To be migrated your question would need to satisfy the requirements to be on-topic at the destination, including (for StackOverflow) a minimal reproducible example (i.e. one where readers could copy-paste code to get the data set up and compare any attempted solution with your desired result). If you can edit to clarify your question and make it clearly on topic there, please flag to ask for this question to be migrated there. $\endgroup$
    – Glen_b
    Mar 8, 2016 at 22:21

1 Answer 1

1
$\begingroup$

try this :

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

$\endgroup$
0

Not the answer you're looking for? Browse other questions tagged or ask your own question.