Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

bdiagRep

Create a Block Diagonal Matrix by Repeating the Input


Description

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

Usage

bdiagRep(x, times)

Arguments

x

A numeric or character matrix (or values)

times

Number of times of x to be repeated

Value

A numeric or character block diagonal matrix

Author(s)

Mike W.-L. Cheung <mikewlcheung@nus.edu.sg>

See Also

Examples

## 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"

metaSEM

Meta-Analysis using Structural Equation Modeling

v1.2.5
GPL (>= 2)
Authors
Mike Cheung [aut, cre] (<https://orcid.org/0000-0003-0113-0758>)
Initial release
2020-11-29

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.