Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

symMatrix

Symmetric Matrix


Description

Create a Symmetric Matrix.

Usage

symMatrix( data = NA, nrow = NULL, byrow = FALSE,
   upper = FALSE )

Arguments

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.

Value

a symmetric matrix.

Author(s)

Arne Henningsen

See Also

Examples

# 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 )

miscTools

Miscellaneous Tools and Utilities

v0.6-26
GPL (>= 2)
Authors
Arne Henningsen, Ott Toomet
Initial release
2019-12-08

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.