Flatten correlation matrix to pairs
flatten_corr_mat(cormat)
cormat | correlation matrix computed with stats::cor |
---|
flattened correlation matrix (pairs of features their correlation)
Zena Lapp, zenalapp@umich.edu
set.seed(0) mat <- matrix(runif(100), nrow = 20) rownames(mat) <- 1:nrow(mat) colnames(mat) <- 1:ncol(mat) corr_mat <- stats::cor(mat, method = "spearman") flatten_corr_mat(corr_mat)#> feature1 feature2 corr #> 1 1 2 -0.17293233 #> 2 1 3 -0.42255639 #> 3 2 3 0.16691729 #> 4 1 4 -0.37142857 #> 5 2 4 0.30676692 #> 6 3 4 -0.04210526 #> 7 1 5 0.13684211 #> 8 2 5 0.10676692 #> 9 3 5 -0.57293233 #> 10 4 5 0.03759398