Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

cor_select

Subset Correlation Matrix


Description

Subset Correlation Matrix

Usage

cor_select(x, ..., vars = NULL)

Arguments

x

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

...

One or more unquoted expressions (or variable names) separated by commas. Used to select variables of interest.

vars

a character vector containing the variable names of interest.

Value

a data frame

See Also

Examples

# Compute correlation matrix
#::::::::::::::::::::::::::::::::::::::::::
cor.mat <- mtcars %>%
  select(mpg, disp, hp, drat, wt, qsec) %>%
  cor_mat()

# Subsetting correlation matrix
#::::::::::::::::::::::::::::::::::::::::::

# Select some variables of interest
cor.mat %>%
  cor_select(mpg, drat, wt)

# Remove variables
cor.mat %>%
  cor_select(-mpg, -wt)

rstatix

Pipe-Friendly Framework for Basic Statistical Tests

v0.7.0
GPL-2
Authors
Alboukadel Kassambara [aut, cre]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.