Create a matrix
modMATRIX( x, use = TRUE, block = FALSE, correlation = FALSE, digits = -1, context = "matlist", ... )
| x | data for building the matrix. Data in |
|---|---|
| use | logical; if FALSE, all matrix elements are set to 0 |
| block | logical; if TRUE, try to make a block matrix; diagonal otherwise |
| correlation | logical; if TRUE, off diagonal elements are assumed to be correlations and converted to covariances; if correlation is TRUE, then block is set to TRUE |
| digits | if value of this argument is greater than zero, the matrix is passed to signif (along with digits) prior to returning |
| context | the working context |
| ... | passed along |
modMATRIX("1 2.2 333")#> [,1] [,2] [,3] #> [1,] 1 0.0 0 #> [2,] 0 2.2 0 #> [3,] 0 0.0 333modMATRIX("1 1.1 2.2", block=TRUE)#> [,1] [,2] #> [1,] 1.0 1.1 #> [2,] 1.1 2.2modMATRIX("23 234 234 5234", use=FALSE)#> [,1] [,2] [,3] [,4] #> [1,] 0 0 0 0 #> [2,] 0 0 0 0 #> [3,] 0 0 0 0 #> [4,] 0 0 0 0ans <- modMATRIX("1.1 0.657 2.2", correlation=TRUE, block=TRUE) ans#> [,1] [,2] #> [1,] 1.100000 1.022052 #> [2,] 1.022052 2.200000#> [,1] [,2] #> [1,] 1.000 0.657 #> [2,] 0.657 1.000