| cor_select | R Documentation |
See the Datanovia tutorial Correlation Matrix in R for a worked walkthrough.
cor_select(x, ..., vars = NULL)
x |
a correlation matrix. Particularly, an object of class |
... |
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. |
a data frame
cor_mat(), pull_triangle(), replace_triangle().
The Datanovia tutorial:
Correlation Matrix in R.
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.