test.fisher: Fisher's Exact Test

View source: R/Fisher_test.R

test.fisherR Documentation

Fisher's Exact Test

Description

Performs Fisher's Exact Test using two categorical vectors or a data frame with two columns, constructing a contingency table and optionally generating graphical visualizations.

Usage

test.fisher(
  x,
  y = NULL,
  title = "Fisher's Exact Test",
  xlab = NULL,
  ylab = "Proportion",
  style = c("stacked", "barplot", "mosaic", "pie"),
  show_table = TRUE,
  help = FALSE,
  verbose = TRUE
)

Arguments

x

Categorical vector or data frame with two columns.

y

Categorical vector (required if x_var is a vector).

title

Plot title (string). Default: "Fisher's Exact Test"

xlab

Name of the x-axis in the plot (string). Default: NULL (uses variable name)

ylab

Name of the y-axis in the plot (string). Default: "Proportion"

style

Plot style. Controls the visualization type

show_table

Logical. If TRUE, prints the contingency table to the console. Default: TRUE

help

Logical. If TRUE, shows detailed function explanation. Default: FALSE

verbose

Logical. If TRUE, prints detailed test messages. Default: TRUE

Value

Invisible object containing the Fisher test result.

Examples

data <- data.frame(control = c("healthy","healthy","sick","sick","sick"),
                   treatment = c("healthy","healthy","healthy","healthy","sick"))
test.fisher(data)

autotestR documentation built on April 29, 2026, 1:09 a.m.