MAT_half2full: Half to full matrix

View source: R/matrices.R

MAT_half2fullR Documentation

Half to full matrix

Description

From a half matrix, recreate a full symmetric matrix. Uses either lower or upper triangle.

Usage

MAT_half2full(mat, lower = T, diag = F)

Arguments

mat

(matrix) A symmetric matrix

lower

(lgl) Whether to use the lower or higher triangle.

diag

(lgl) Whether the diagonal values should be included or not.

Value

A matrix

Examples

m = matrix(1:9, ncol=3)
rownames(m) = letters[1:3]
colnames(m) = LETTERS[1:3]
m %>% MAT_half2full
m %>% MAT_half2full(lower=F)
m %>% MAT_half2full(diag=T)
m %>% MAT_half2full(lower=F, diag=T)

Deleetdk/kirkegaard documentation built on Sept. 28, 2024, 1:51 p.m.