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

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

\item{step}{A positive numeric value specifying the
expected increment between consecutive values.
Default is 1.}
}
\value{
A data.frame of class \code{SequenceCheck}
containing row-level sequence diagnostics.
}
\description{
Checks a numeric or integer variable for missing values,
duplicated values, ordering problems, and gaps in an
expected sequence.
}
\details{
The sequence is evaluated in the original row order.

A duplicate is a non-missing value appearing more than
once in the variable. All occurrences of duplicated
values are flagged.

For each non-missing observation after the first available
observation, the difference from the previous non-missing
value is calculated.

An ordering problem occurs when this difference is less
than or equal to zero. Duplicate values are therefore also
ordering problems.

A gap occurs when the difference from the previous
non-missing value is greater than \code{step}.

Differences smaller than \code{step} but greater than zero
are classified as step mismatches.

Missing observations are reported separately.
}
\examples{
dat <- data.frame(
  Visit = c(1, 2, 4, 4, 3, NA, 5)
)

sequence_check(
  dat,
  variable = "Visit"
)

sequence_check(
  data.frame(Time = c(0, 5, 10, 20)),
  variable = "Time",
  step = 5
)

}
