test_t_paired: Paired t-test with advanced visualizations

View source: R/Paired_T_test.R

test_t_pairedR Documentation

Paired t-test with advanced visualizations

Description

Performs a paired t-test to compare the means of two related measurements, such as before-and-after observations, using two numeric vectors of equal length or two numeric columns from a data frame. Includes four visualization styles: boxplot, violin, mono, and halfeye.

Usage

test_t_paired(
  ...,
  title = "Paired t-test",
  xlab = "",
  ylab = "Value",
  style = c("boxplot", "violin", "mono", "halfeye"),
  colors = NULL,
  connect = TRUE,
  help = FALSE,
  verbose = TRUE
)

Arguments

...

Two numeric vectors of equal length, or a data frame containing exactly two numeric columns.

title

Character string specifying whether to display a plot title or providing the title text, depending on the function implementation.

xlab

Character string specifying the x-axis label.

ylab

Character string specifying the y-axis label.

style

Character string specifying the plot style generated by the function. One of boxplot, violin, mono, or halfeye. Default: boxplot.

colors

Optional character vector specifying the plot colors.

connect

Logical. If TRUE, connects paired observations in the plot.

help

Logical. If TRUE, displays a detailed explanation of the function.

verbose

Logical. If TRUE, prints progress messages.

Value

An invisible list containing the following components:

summary_table

Summary statistics, including group means and standard deviations.

test_result

Result object returned by stats::t.test, containing the paired t-test results.

data

Data frame containing the data used for plotting.

plot

Plot object generated using ggplot2.

Examples

before <- c(13, 12, 15, 14)
after <- c(9, 11, 10, 10)
test_t_paired(before, after)

autotestR documentation built on Oct. 27, 2026, 1:07 a.m.