cor_with_target: This function correlates a set of target variables (target)...

View source: R/cor_with_target.R

cor_with_targetR Documentation

This function correlates a set of target variables (target) with a set of other variables (withvars). The general goal is to avoid sifting through gargantuan correlation matrices when only some cells are of interest a priori.

Description

This function correlates a set of target variables (target) with a set of other variables (withvars). The general goal is to avoid sifting through gargantuan correlation matrices when only some cells are of interest a priori.

Usage

cor_with_target(
  df,
  omit = NULL,
  target,
  withvars = NULL,
  pmin = NULL,
  partial = NULL,
  absrmin = NULL,
  digits = 3,
  prewhiten = FALSE,
  orderbyr = FALSE
)

Arguments

df

The data.frame containing data to be correlated

omit

A vector of variables that should not be included in the withvars.

target

A vector of variable names that are correlated with withvars.

withvars

A vector of variable names, each of which is correlates with each target. If omitted, all variables are included.

pmin

The highest correlation p-value that should be included in the output (e.g., to omit non-sig correlations)

partial

A character vector of variable names to partial out of the target correlations

absrmin

The minimum absolute r value to print

digits

The number of digits to return for correlations and p values

prewhiten

Whether to remove the temporal autocorrelation structure of each variable prior correlation (using ARIMA)

orderbyr

Whether to sort the correlation output by the magnitude of the correlation

Value

A list of correlations where each element is a vector of a target variable with all withvvars

Author(s)

Michael Hallquist


PennStateDEPENdLab/dependlab documentation built on April 10, 2024, 5:15 p.m.