Learn R Programming

autostats (version 0.4.1)

auto_cor: auto correlation

Description

Finds the correlation between numeric variables in a data frame, chosen using tidyselect. Additional parameters for the correlation test can be specified as in cor.test

Usage

auto_cor(
  .data,
  ...,
  use = c("pairwise.complete.obs", "all.obs", "complete.obs", "everything",
    "na.or.complete"),
  method = c("pearson", "kendall", "spearman", "xicor"),
  include_nominals = TRUE,
  max_levels = 5L,
  sparse = TRUE,
  pval_thresh = 0.1
)

Value

data frame of correlations

Arguments

.data

data frame

...

tidyselect cols

use

method to deal with na. Default is to remove rows with NA

method

correlation method. default is pearson, but also supports xicor.

include_nominals

logicals, default TRUE. Dummify nominal variables?

max_levels

maximum numbers of dummies to be created from nominal variables

sparse

logical, default TRUE. Filters and arranges cor table

pval_thresh

threshold to filter out weak correlations

Details

includes the asymmetric correlation coefficient xi from xicor

Examples

Run this code

iris %>%
auto_cor()

# don't use sparse if you're interested in only one target variable
iris %>%
auto_cor(sparse = FALSE) %>%
dplyr::filter(x == "Petal.Length")

Run the code above in your browser using DataLab