% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/audit_data.R
\name{audit_data}
\alias{audit_data}
\title{Perform a General Data Quality Audit}
\usage{
audit_data(data, include_nzv = TRUE, rules = NULL)
}
\arguments{
\item{data}{A data.frame.}

\item{include_nzv}{Logical. If TRUE, near-zero variance
variables are included in the audit. Default is TRUE.}

\item{rules}{Optional object of class \code{DataAuditRules}
created by \code{\link{audit_rules}}. When supplied,
the rules are evaluated and included in the audit
report.}
}
\value{
An object of class \code{DataAuditReport}.
}
\description{
Performs a general audit of a data frame and summarizes
common data-quality problems including missing values,
blank values, infinite values, constant variables,
near-zero variance variables, and duplicated rows.
}
\details{
\code{audit_data()} is intended as a general first-pass
audit requiring minimal user configuration.

More specialized checks such as ranges, categories,
patterns, identifiers, dates, dependencies, and
cross-variable consistency can be performed using the
corresponding DataAudit functions.

Custom validation rules created with
\code{\link{audit_rules}} can be supplied through
\code{rules}. These rules are evaluated using
\code{\link{apply_audit_rules}}.

The returned object contains:

\itemize{
\item \code{overview}: basic dataset information.
\item \code{variables}: variable-level audit summary.
\item \code{duplicates}: duplicated-row diagnostics.
\item \code{summary}: overall audit statistics.
\item \code{rules}: custom rule results, or NULL when
no rules are supplied.
}
}
\examples{
dat <- data.frame(
  ID = c(1, 2, 2, 4),
  Species = c("Dog", "", "", "Cat"),
  Value = c(10, NA, Inf, 20),
  Constant = 1
)

audit_data(dat)

rules <- audit_rules(
  range = list(
    Value = c(0, 100)
  ),
  required = "Species"
)

audit_data(
  dat,
  rules = rules
)

}
