Skip to content
Prev 257638 / 398506 Next

combining matrices

On 2011-04-21 07:03, Marten Winter wrote:
If you don't need this very often or very general, then use

  mat <- diag(0,4)
  mat[1:2, 1:2] <- A
  mat[3:4, 3:4] <- B
  mat

If you do need more flexibility, you could use the 'assist'
package's function bdiag() which handles block-diagonal
matrices:

  require(assist)
  mat <- bdiag(list(A,B))

Peter Ehlers