% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/id_check.R
\name{id_check}
\alias{id_check}
\title{Check Identifier Integrity}
\usage{
id_check(data, variable, pattern = NULL)
}
\arguments{
\item{data}{A data.frame.}

\item{variable}{A single character string specifying the
identifier variable to check.}

\item{pattern}{Optional regular expression that valid
identifiers must match.}
}
\value{
A data.frame of class \code{IDCheck} containing
row-level identifier diagnostics.
}
\description{
Checks an identifier variable for missing values, blank
values, duplicates, leading or trailing whitespace, and
optionally values that do not match a regular expression.
}
\details{
Character, factor, numeric, and integer identifier
variables are supported.

Duplicate detection excludes missing and blank values.

Whitespace checks are performed on the character
representation of the identifier.

If \code{pattern} is supplied, non-missing and non-blank
identifiers that do not match the pattern are flagged.

The function does not modify the original data.
}
\examples{
dat <- data.frame(
  Animal_ID = c(
    "A001",
    "A002",
    "A002",
    " A003",
    "",
    NA
  )
)

id_check(
  dat,
  variable = "Animal_ID",
  pattern = "^A[0-9]{3}$"
)

}
