Skip to contents

This function converts a correlation matrix into a data frame containing the correlation values and their corresponding interaction names.

Usage

correlation_matrix_2df(corr_matrix)

Arguments

corr_matrix

A correlation matrix to be converted.

Value

A data frame with the correlation values and corresponding interaction names.

Examples

mat <- matrix(c(1, 0.7, 0.5, 0.7, 
                 1, 0.3, 0.5, 0.3, 1), 
                 nrow = 3, 
                 dimnames = list(c("A", "B", "C"), 
                                 c("A", "B", "C")))
correlation_matrix_2df(mat)
#>   estimate     term
#> 1      0.7 cor__A.B
#> 2      0.5 cor__A.C
#> 3      0.3 cor__B.C