makeSymmetric: make a symmetrix matrix

Description Usage Arguments Value Author(s) Examples

Description

takes a matrix and copies its lower or upper triangle to generate a symmetric matrix

Usage

1
makeSymmetric(m, upper = TRUE)

Arguments

m

a square matrix

upper

(logical) copy upper triangle to lower triangle? (Alternatively, copy upper triangle to lower triangle.)

Value

a matrix with the same dimensions as m, but made symmetric

Author(s)

Ben Bolker

Examples

1
2
3
4
  m = matrix(1:9,nrow=3)
  m
  makeSymmetric(m)
  makeSymmetric(m,upper=FALSE)

bbolker/cpcbp documentation built on May 11, 2019, 9:28 p.m.