| Title: | Boxplot and Significance Test for Two Groups |
|---|---|
| Description: | Creates a side-by-side boxplot for a continuous variable grouped by a two-level categorical variable, checks normality assumptions, and runs the appropriate statistical test (t-test or Wilcoxon rank-sum test). Returns a publication-ready plot and test statistics including test statistic, degrees of freedom, and p-value. |
| Authors: | Arkaprabha Sau [aut, cre], Santanu Phadikar [aut], Ishita Bhakta [aut] |
| Maintainer: | Arkaprabha Sau <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.0 |
| Built: | 2026-06-01 08:34:03 UTC |
| Source: | https://github.com/arka1985/boxtest |
Generates side-by-side boxplots and runs Shapiro-Wilk by group, then t-test (if both normal) or Wilcoxon rank-sum test. Returns a structured list with plots and a clear test summary.
compare_two_groups(data, continuous, group)compare_two_groups(data, continuous, group)
data |
A data.frame |
continuous |
Name of continuous variable (string) |
group |
Name of categorical variable with exactly 2 levels (string) |
A list containing:
A ggplot object of the boxplot.
A data.frame showing Shapiro-Wilk p-values for each group.
A data.frame summarizing the statistical test used, statistic, df, and p-value.
res <- compare_two_groups(mtcars, "mpg", "am") res$plot res$normality res$test_summaryres <- compare_two_groups(mtcars, "mpg", "am") res$plot res$normality res$test_summary