# Introduction to boxTest

# Introduction

The boxTest package provides a simple workflow for comparing two groups using boxplots and statistical tests. It automatically:

1. Checks normality via Shapiro–Wilk test.

2. Applies the appropriate test:

   - Independent 2-sample t-test (if both groups are normal)
   - Mann–Whitney U test (if at least one group is non-normal)

3. Returns a publication-ready boxplot with optional jittered points.

# Example

We will use the built-in `mtcars` dataset to compare mpg between automatic (`am = 0`) and manual (`am = 1`) cars.

    # Load package
    library(boxTest)

    # Compare mpg between automatic and manual cars
    res <- compare_two_groups(mtcars, "mpg", "am")

    # Display the boxplot
    res$plot

# Normality Check

The function also returns the Shapiro-Wilk normality test results for each group.

    res$normality
    #>   group shapiro_W   p_value normal
    #> 0     0 0.9767743 0.8987358   TRUE
    #> 1     1 0.9458037 0.5362729   TRUE

# Test Summary

Finally, the package provides a summary of the statistical test applied, including test statistic, degrees of freedom, and p-value.

    res$test_summary
    #>                        method statistic df      p_value
    #> 1 Independent 2-sample t-test -4.106127 30 0.0002850207

# Conclusion

The boxTest package streamlines exploratory analysis and significance testing for two-group comparisons in R. It is particularly useful for beginners and provides a clear, publication-ready output.