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

reflect_triangle

Reflect upper/lower triangle across diagonal


Description

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

Usage

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

Arguments

m

a square matrix

from

lower or upper triangle

Value

a symmetric square matrix

Author(s)

References

Examples

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

stackoverflow

Stack Overflow's Greatest Hits

v0.7.0
CC BY-SA 4.0
Authors
Neal Fultz <nfultz@gmail.com> and the StackOverflow.com community
Initial release
2020-01-03

We don't support your browser anymore

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