% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/Chi_test.R
\name{test.chi}
\alias{test.chi}
\title{Chi-square test}
\usage{
test.chi(
  x,
  y = NULL,
  title = "Chi-square Test",
  xlab = NULL,
  ylab = "Proportion",
  style = c("stacked", "barplot", "mosaic", "pie"),
  show_table = TRUE,
  help = FALSE,
  verbose = TRUE
)
}
\arguments{
\item{x}{Categorical vector or data frame with two columns (group 1 and group 2).}

\item{y}{Categorical vector (group 2). Required if x is a vector.}

\item{title}{Plot title (string). Default: "Chi-square Test".}

\item{xlab}{X-axis label in the plot (string). Default: NULL (uses variable name).}

\item{ylab}{Y-axis label in the plot (string). Default: "Proportion".}

\item{style}{Plot style generated by the function.}

\item{show_table}{Logical. If TRUE, prints the contingency table to the console.
Default: TRUE.}

\item{help}{Logical. If TRUE, displays a detailed explanation of the function.
Default: FALSE.}

\item{verbose}{Logical. If TRUE, prints messages about the test and expected
frequencies. Default: TRUE.}
}
\value{
Test result and contingency table.
}
\description{
Applies the Pearson chi-square test or Fisher's exact test to assess association
between two categorical variables.
}
\examples{

data <- data.frame(
  control = c(rep("healthy", 50), rep("sick", 150)),
  treatment = c(rep("healthy", 100), rep("sick", 100))
)
test.chi(data)
}
