matrix2vectors: Convert Between Correlation Matrix and Upper Triangle...

Description Usage Arguments Examples

Description

Tools to convert between a correlation matrix and a dataframe of upper triangle values and variable components. The dataframe is more intuitive for applying functions while the correlation matrix is more intuitive to visualize.

Usage

1
2
3
  matrix2vectors(cor.mat)

  vectors2matrix(cor.vect)

Arguments

cor.mat

A square, symetrical matrix with ones on the diagonal (a correlation matrix).

cor.vect

A dataframe with the row variables of the correlation matrix in the first column, the column names in the second column and the corresponding correlations in the third column.

Examples

1
2
3
4
(mat <- round(cor(mtcars[, 1:5]), 2))
matrix2vectors(mat)
cor.vect <- matrix2vectors(round(cor(mtcars[, 1:5]), 2))
vectors2matrix(cor.vect)

trinker/metaDAT documentation built on May 31, 2019, 8:52 p.m.