Get variables for which a group difference exists
Source:R/descriptives.R
get_sig_differences_between_groups.RdThis function returns a vector of variable names for which there is a significant difference between specified groups.
Arguments
- df
data.frame
- test_vars
(character) vector of variable names to test for differences (if
NULL, all vars exceptgroup)- group
(character) name of grouping variable
Value
(character) vector of test variables for which there is a significant difference between groups
Details
Group differences are tested using ANOVA (for numeric test variables) or
Chi-square (for categorical test variables) with ana_fn_aov() and ana_fn_chisq().
Significant differences are determined using the threshold p < .05.
Examples
if (FALSE) {
df |> get_sig_differences_between_groups(c("Age", "Nationality"), group="Gender")
}