cor_reorder: Reorder Correlation Matrix

View source: R/cor_reorder.R

cor_reorderR Documentation

Reorder Correlation Matrix

Description

reorder correlation matrix, according to the coefficients, using the hierarchical clustering method.

Usage

cor_reorder(x)

Arguments

x

a correlation matrix. Particularly, an object of class cor_mat.

Value

a data frame

See Also

cor_mat(), cor_gather(), cor_spread()

Examples

# 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()


rstatix documentation built on Feb. 16, 2023, 6:10 p.m.