Learn R Programming

GDINA (version 2.9.4)

bdiagMatrix: Create a block diagonal matrix

Description

Create a block diagonal matrix

Usage

bdiagMatrix(mlist, fill = 0)

Value

a block diagonal matrix

Arguments

mlist

a list of matrices

fill

value to fill the non-diagnoal elements

See Also

bdiag in Matrix

Examples

Run this code

m1 <- bdiagMatrix(list(matrix(1:4, 2), diag(3)))
m2 <- bdiagMatrix(list(matrix(1:4, 2), diag(3)),fill = NA)

Run the code above in your browser using DataLab