I want to build a block diagonal matrix (A) from a known matrix (B) by putting B in diagonal positions of A.
Let's say my B:
> matrix(c(1,3,4,5),nrow=2)
[,1] [,2]
[1,] 1 4
[2,] 3 5
I am looking for a function like this: function(B,3)
(3 is just a random number) which returns matrix A like this:
[1,] 1 4 . . . .
[2,] 3 5 . . . .
[3,] . . 1 4 . .
[4,] . . 3 5 . .
[5,] . . . . 1 4
[6,] . . . . 3 5
Really appreciate any help