correlate: Compute correlation coefficients

View source: R/correlation.R

correlateR Documentation

Compute correlation coefficients

Description

Computes correlation coefficients for all combinations of the specified variables. If no variables are specified, all numeric (integer or double) variables are used.

Usage

correlate(data, ..., method = "pearson", partial = NULL, with = NULL)

Arguments

data

a tibble or a tdcmm model

...

Variables to compute correlations for (column names). Leave empty to compute for all numeric variables in data.

method

a character string indicating which correlation coefficient is to be computed. One of "pearson" (default), "kendall", or "spearman"

partial

Specifies a variable to be used as a control in a partial correlation. By default, this parameter is set to NULL, indicating that no control variable is used in the correlation. If used, with must be set to NULL (default).

with

Specifies a focus variable to correlate all other variables with. By default, this parameter is set to NULL, indicating that no focus variable is used in the correlation. If used, partial must be set to NULL (default).

Value

a tdcmm model

Examples

WoJ %>% correlate(ethics_1, ethics_2, ethics_3)
WoJ %>% correlate()
WoJ %>% correlate(ethics_1, ethics_2, ethics_3, with = work_experience)
WoJ %>% correlate(autonomy_selection, autonomy_emphasis, partial = work_experience)
WoJ %>% correlate(with = work_experience)


joon-e/tidycomm documentation built on Feb. 24, 2024, 8:58 a.m.