complete_matrix: Make a matrix symmetric by averaging with its transpose

View source: R/utility.R

complete_matrixR Documentation

Make a matrix symmetric by averaging with its transpose

Description

Makes a matrix symmetric by averaging the elements of the matrix and its transpose. When This function fills in NA elements of a matrix with the corresponding value from the matrix transpose, if available

Usage

complete_matrix(m, na.rm = TRUE)

Arguments

m

Numeric matrix to complete.

na.rm

Logical. Should missing values be dropped? (default: TRUE)

Value

A completed matrix.

Examples

predictors <- c('auto', 'skill_var', 'task_var', 'task_sig', 'task_id',
'fb_job', 'job_comp', 'interdep', 'fb_others', 'soc_support')
m <- jobchar$sevar_r[c('perform', predictors), c('perform', predictors)]
complete_matrix(m)

bwiernik/configural documentation built on March 18, 2024, 11:02 p.m.