reflect_triangle: Reflect upper/lower triangle across diagonal

Description Usage Arguments Value Author(s) References Examples

View source: R/triangle.R

Description

Create a new matrix by copying the lower(upper) triangle to the other half.

Usage

1
reflect_triangle(m, from = c("lower", "upper"))

Arguments

m

a square matrix

from

lower or upper triangle

Value

a symmetric square matrix

Author(s)

Josh O'Brien

References

https://stackoverflow.com/questions/26166569/copy-upper-triangle-to-lower-triangle-for-several-matrices-in-a-list

Examples

1
2
3
  x <- matrix(1:9,3,3)
  reflect_triangle(x, "lower")
  reflect_triangle(x, "upper")

stackoverflow documentation built on Jan. 10, 2020, 9:07 a.m.