Package 'boxTest'

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

Help Index


Compare Two Groups with Boxplot and Significance Test

Description

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.

Usage

compare_two_groups(data, continuous, group)

Arguments

data

A data.frame

continuous

Name of continuous variable (string)

group

Name of categorical variable with exactly 2 levels (string)

Value

A list containing:

plot

A ggplot object of the boxplot.

normality

A data.frame showing Shapiro-Wilk p-values for each group.

test_summary

A data.frame summarizing the statistical test used, statistic, df, and p-value.

Examples

res <- compare_two_groups(mtcars, "mpg", "am")
res$plot
res$normality
res$test_summary