Description Usage Arguments Value Author(s) References Examples
Takes a vector and, if the vector is of the correct lenght to be made into a symmetric matrix, performs the conversion.
1 | vec2symmat(invec, diag = 1, byrow = TRUE)
|
invec |
The input vector |
diag |
The value for the diagonal |
byrow |
Logical. Whether the upper-triangle should be filled in by row |
A matrix
Ananda Mahto
http://stackoverflow.com/a/18598933/1270695
1 2 3 4 5 | myvec <- c(-.55, -.48, .66, .47, -.38, -.46)
vec2symmat(myvec)
vec2symmat(1:15, diag = 0)
vec2symmat(1:15, diag = 0, byrow = FALSE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.