Description Usage Arguments Value Author(s) See Also Examples

It creates a block diagonal matrix by repeating the input matrix several times.

1 | ```
bdiagRep(x, times)
``` |

`x` |
A numeric or character matrix (or values) |

`times` |
Number of times of |

A numeric or character block diagonal matrix

Mike W.-L. Cheung <[email protected]>

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ```
## Block diagonal matrix of numerics
bdiagRep( matrix(1:4,nrow=2,ncol=2), 2 )
# [,1] [,2] [,3] [,4]
# [1,] 1 3 0 0
# [2,] 2 4 0 0
# [3,] 0 0 1 3
# [4,] 0 0 2 4
## Block diagonal matrix of characters
bdiagRep( matrix(letters[1:4],nrow=2,ncol=2), 2 )
# [,1] [,2] [,3] [,4]
# [1,] "a" "c" "0" "0"
# [2,] "b" "d" "0" "0"
# [3,] "0" "0" "a" "c"
# [4,] "0" "0" "b" "d"
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.