% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/group_sequence_check.R
\name{group_sequence_check}
\alias{group_sequence_check}
\title{Check Sequence Integrity Within Groups}
\usage{
group_sequence_check(data, group, variable, step = 1)
}
\arguments{
\item{data}{A data.frame.}

\item{group}{A single character string specifying the
grouping variable.}

\item{variable}{A single character string specifying the
numeric or integer sequence variable.}

\item{step}{A positive finite numeric value specifying the
expected increment. Default is 1.}
}
\value{
A data.frame of class \code{GroupSequenceCheck}
containing row-level sequence diagnostics.
}
\description{
Checks a numeric or integer sequence independently within
groups for missing values, duplicates, ordering problems,
gaps, and step mismatches.
}
\details{
Sequence integrity is evaluated independently within each
group and in the original row order.

Missing values in the grouping variable are retained and
treated as a separate missing group for diagnostic
purposes.

Missing sequence values are reported separately and are
excluded when calculating previous values and differences.

All occurrences of duplicated non-missing sequence values
within a group are flagged.

A gap occurs when the difference from the previous
non-missing value within the same group is greater than
\code{step}.
}
\examples{
dat <- data.frame(
  Animal_ID = c(
    "A001", "A001", "A001",
    "A002", "A002", "A002"
  ),
  Visit = c(
    1, 2, 4,
    1, 2, 2
  )
)

group_sequence_check(
  dat,
  group = "Animal_ID",
  variable = "Visit"
)

}
