cor.with: Correlation with Grouping Variable

View source: R/dthelper-computation-functions.R

cor.withR Documentation

Correlation with Grouping Variable

Description

Perform correlations with the main variables of interest. Group can be specified to perform correlations within different subsets of the data.

Usage

cor.with(df, var, with = colnames(df), group = NULL, dp = 2)

Arguments

df

data.frame object

var

Variables of main interest

with

Variable to correlate with. Defaults to all other in df

group

Grouping variable. If specified, correlation will be performed within each group separately

dp

Percentage of missing data will be reported. dp allows re-specification of number of decimal places

id

Identifier variable. Input as string

Value

data.frame object

Examples

library(car)
cor.with(mtcars, var = c("vs"), group = "am")
cor.with(mtcars, var = c("vs", "cyl"))


dennisteowh/dthelper documentation built on March 19, 2022, 11:42 a.m.