| cor_reorder | R Documentation |
reorder correlation matrix, according to the coefficients, using the hierarchical clustering method.
See the Datanovia tutorial Correlation Matrix in R for a worked walkthrough.
cor_reorder(x)
x |
a correlation matrix. Particularly, an object of class |
a data frame
cor_mat(), cor_gather(), cor_spread()
The Datanovia tutorial: Correlation Matrix in R.
# Compute correlation matrix
#::::::::::::::::::::::::::::::::::::::::::
cor.mat <- mtcars %>%
select(mpg, disp, hp, drat, wt, qsec) %>%
cor_mat()
# Reorder by correlation and get p-values
#::::::::::::::::::::::::::::::::::::::::::
# Reorder
cor.mat %>%
cor_reorder()
# Get p-values of the reordered cor_mat
cor.mat %>%
cor_reorder() %>%
cor_get_pval()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.