upper2full: Convert Upper Triangular Matrix to Full Matrix

Description Usage Arguments Value Examples

View source: R/upper2full.R

Description

Convert the upper triangular part of a matrix to a full symmetric matrix.

Usage

1
upper2full(up, diagval = NULL)

Arguments

up

A matrix in which the upper trianglular part is of interest.

diagval

A vector of values to be used for the diagonal of the returned symmetric matrix. May be the same length as each dimension of up or may be of length 1. If Null, the default, the diagonal values will be taken from up.

Value

A symmetric matrix the same dimensions as up, with diagonal values assigned according to diagval.

Examples

1
2
3
4
m <- matrix(1:16, nrow=4, byrow=TRUE)
upper2full(m)
upper2full(m, 0)
upper2full(m, 1:4)

JVAdams/jvamisc documentation built on Aug. 11, 2021, 6:43 a.m.