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

correlate(data, ..., method = "pearson")

Arguments

data

a tibble

...

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"

Value

a tibble

Examples

WoJ %>% correlate(ethics_1, ethics_2, ethics_3)
#> # A tibble: 3 x 5 #> x y r df p #> <chr> <chr> <dbl> <int> <dbl> #> 1 ethics_1 ethics_2 0.172 1198 2.04e- 9 #> 2 ethics_1 ethics_3 0.165 1198 8.44e- 9 #> 3 ethics_2 ethics_3 0.409 1198 1.05e-49
WoJ %>% correlate()
#> # A tibble: 55 x 5 #> x y r df p #> <chr> <chr> <dbl> <int> <dbl> #> 1 autonomy_selection autonomy_emphasis 0.644 1192 4.83e-141 #> 2 autonomy_selection ethics_1 -0.0766 1195 7.98e- 3 #> 3 autonomy_selection ethics_2 -0.0274 1195 3.43e- 1 #> 4 autonomy_selection ethics_3 -0.0257 1195 3.73e- 1 #> 5 autonomy_selection ethics_4 -0.0781 1195 6.89e- 3 #> 6 autonomy_selection work_experience 0.161 1182 2.71e- 8 #> 7 autonomy_selection trust_parliament -0.00840 1195 7.72e- 1 #> 8 autonomy_selection trust_government 0.0414 1195 1.53e- 1 #> 9 autonomy_selection trust_parties 0.0269 1195 3.52e- 1 #> 10 autonomy_selection trust_politicians 0.0109 1195 7.07e- 1 #> # ... with 45 more rows