
Compares groups by (1) creating histogram by group; (2) summarizing descriptive statistics by group; and (3) conducting pairwise comparisons (t-tests and Mann-Whitney tests).
compare_groups(
data = NULL,
iv_name = NULL,
dv_name = NULL,
sigfigs = 3,
mann_whitney = TRUE,
t_test_stats = FALSE
)
the output will be a list of (1) ggplot object (histogram by group) (2) a data.table with descriptive statistics by group; and (3) a data.table with pairwise comparison results
a data object (a data frame or a data.table)
name of the independent variable (grouping variable)
name of the dependent variable (measure variable of interest)
number of significant digits to round to
if mann_whitney = TRUE
, Mann-Whitney test
results will be included in the pairwise comparison data.table.
If mann_whitney = FALSE
, Mann-Whitney tests will not be performed.
if t_test_stats = TRUE
, t-test statistic
and degrees of freedom will be included in the pairwise
comparison data.table.
compare_groups(data = iris, iv_name = "Species", dv_name = "Sepal.Length")
Run the code above in your browser using DataLab