get_var_corr: Get correlations between variables

Description Usage Arguments Value Examples

Description

This function returns the correlations between different variables.

Usage

1
2
3
4
5
6
7
8
get_var_corr(
  df,
  comparison_var = NULL,
  other_vars = NULL,
  method = "pearson",
  drop_columns = c("factor", "character"),
  ...
)

Arguments

df

The data set for which correlations are required

comparison_var

The variable to compare to

other_vars

variables for which correlation with comparison_var is required. If not supplied, all variables will be used.

method

The method used to perform the correlation test as defined in 'cor.test'. Defaults to pearson.

drop_columns

A character vector specifying column classes to drop. Defaults to c("factor","character")

...

Other arguments to 'cor.test' see ?cor.test for details

Value

A data.frame object containing correlations between comparison_var and each of other_vars

Examples

1
2
3
4
# Get correlations between all variables
get_var_corr(mtcars,"mpg")
# Use only a few variables
get_var_corr(mtcars,"mpg", other_vars = c("disp","drat"), method = "kendall",exact=FALSE)

manymodelr documentation built on Nov. 15, 2021, 5:07 p.m.