Learn R Programming

ggm (version 2.2)

blkdiag: Block diagonal matrix

Description

Block diagonal concatenation of input arguments.

Usage

blkdiag(...)

Arguments

...
Variable number of matrices M1, M2, ....

Value

  • A block diagonal matrix diag(M1, M2, ...).

See Also

diag

Examples

Run this code
X <- c(1,1,2,2); Z <- c(10, 20, 30, 40); A <- factor(c(1,2,2,2))
blkdiag(model.matrix(~X+Z), model.matrix(~A))

Run the code above in your browser using DataLab