Learn R Programming

fifer (version 1.1)

make.symmetric: Force a matrix to be symmetric

Description

Force a matrix to be symmetric

Usage

make.symmetric(a, lower.tri = TRUE)

Arguments

a
A matrix you wish to force to be symmetrical
lower.tri
Should the upper triangle be replaced with the lower triangle?

Value

a symmetric matrix

Examples

Run this code
a = matrix(rnorm(16), ncol=4)
make.symmetric(a, lower.tri=FALSE)

Run the code above in your browser using DataLab