Helper function for bootstrap_traits_multivariate that extracts results from a correlation matrix

cor_to_df(corr)

Arguments

corr

correlation matrix

Value

A data.frame of correlations

References

Modified from https://stackoverflow.com/a/23476844/2055765

Examples

x <- matrix(ncol = 5, rnorm(20))
colnames(x) <- letters[1:5]
cor(x) |> cor_to_df()
#>    row col      value
#> 1    b   a -0.5727746
#> 2    c   a  0.6241797
#> 3    d   a  0.2829025
#> 4    e   a  0.8263505
#> 5    c   b -0.6891802
#> 6    d   b  0.6228578
#> 7    e   b -0.9119689
#> 8    d   c -0.2481077
#> 9    e   c  0.8495626
#> 10   e   d -0.2884096