R/matrix.R

matrix_helpers.Rd

Create matrices from vector input

bmat(..., correlation = FALSE, digits = -1) cmat(..., digits = -1) dmat(...)

matrix data

logical; if TRUE, off-diagonal elements are assumed to be correlations and converted to covariances

if greater than zero, matrix is passed to signif (along with digits) prior to returning

bmat makes a block matrix. cmat makes a correlation matrix. dmat makes a diagonal matrix.

bmat

cmat

dmat

as_bmat

as_dmat

dmat(1,2,3)/10 #> [,1] [,2] [,3] #> [1,] 0.1 0.0 0.0 #> [2,] 0.0 0.2 0.0 #> [3,] 0.0 0.0 0.3 bmat(0.5,0.01,0.2) #> [,1] [,2] #> [1,] 0.50 0.01 #> [2,] 0.01 0.20 cmat(0.5, 0.87,0.2) #> [,1] [,2] #> [1,] 0.5000000 0.2751182 #> [2,] 0.2751182 0.2000000