---
title: "Introduction to boxTest"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{Introduction to boxTest}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8
---
-------------------------

```{r setup, include=FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
library(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.

```{r example}
# 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.

```{r normality}
res$normality
```

# Test Summary

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

```{r test-summary}
res$test_summary
```

# 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.
