symmetrize | R Documentation |
Complete the upper (or lower) extra-diagonal terms in order to obtain a symmetric matrix.
symmetrize(M, update.upper = TRUE)
M |
a matrix. |
update.upper |
[logical] should the upper extra diagonal terms be updated using the lower extra diagonal terms? |
symmetrize <- lavaSearch2:::symmetrize
## example
M <- matrix(NA, 4, 4)
M[lower.tri(M)] <- 1:6
symmetrize(M, update.upper = TRUE) # good
M[upper.tri(M, diag = FALSE)] <- M[lower.tri(M, diag = FALSE)]
M # wrong
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.