% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/diagnostics.R
\name{tl_detect_outliers}
\alias{tl_detect_outliers}
\title{Detect outliers in the data}
\usage{
tl_detect_outliers(
  data,
  variables = NULL,
  method = "iqr",
  threshold = NULL,
  plot = TRUE
)
}
\arguments{
\item{data}{A data frame containing the data}

\item{variables}{Character vector of variables to check for outliers}

\item{method}{Method for outlier detection: "boxplot", "z-score", "cook",
"iqr", "mahalanobis"}

\item{threshold}{Threshold for outlier detection}

\item{plot}{Logical; whether to create a plot of outliers}
}
\value{
A list with outlier detection results:
\describe{
\item{method}{The detection method used (character).}
\item{method_name}{Human-readable method name (character).}
\item{threshold}{The threshold value used (numeric).}
\item{threshold_label}{Formatted threshold description (character).}
\item{outlier_flags}{A logical matrix (observations x variables).}
\item{any_outlier}{Logical vector indicating if each observation is an
outlier in any variable.}
\item{outlier_counts}{List with \code{total}, \code{by_variable}, and
\code{by_observation} counts.}
\item{outlier_indices}{Integer vector of outlier row indices.}
\item{plot}{A \code{\link[ggplot2]{ggplot}} object, or \code{NULL} if
\code{plot = FALSE}.}
}
}
\description{
Detect outliers in the data
}
\examples{
\donttest{
tl_detect_outliers(mtcars, variables = c("mpg", "wt"), method = "iqr")
}
}
