symMatrix | R Documentation |
Create a Symmetric Matrix.
symMatrix( data = NA, nrow = NULL, byrow = FALSE,
upper = FALSE )
data |
an optional data vector. |
nrow |
the desired number of rows and columns. |
byrow |
logical. If 'FALSE' (the default) the matrix is filled by columns, otherwise the matrix is filled by rows. |
upper |
logical. If 'FALSE' (the default) the lower triangular part of the matrix (including the diagonal) is filled, otherwise the upper triangular part of the matrix is filled. |
a symmetric matrix.
Arne Henningsen
matrix
, lower.tri
.
# fill the lower triangular part by columns
symMatrix( 1:10, 4 )
# fill the upper triangular part by columns
symMatrix( 1:10, 4, upper = TRUE )
# fill the lower triangular part by rows
symMatrix( 1:10, 4, byrow = FALSE )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.