% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/sequence-panel.R
\name{prepare_sequence_panel}
\alias{prepare_sequence_panel}
\title{Prepare longitudinal or panel sequence data}
\usage{
prepare_sequence_panel(
  data,
  panel_id_col,
  occasion_col,
  sequence_id_col = "sequence_id",
  order_col = "sequence_order",
  state_col = "state",
  metadata_cols = NULL,
  require_unique_occasions = TRUE
)
}
\arguments{
\item{data}{Long-format sequence data or a prepared gp3sequences result.}

\item{panel_id_col}{Column identifying the repeatedly observed unit.}

\item{occasion_col}{Column identifying the wave, visit, or occasion.}

\item{sequence_id_col, order_col, state_col}{Core sequence columns.}

\item{metadata_cols}{Optional columns that must remain constant within each
sequence.}

\item{require_unique_occasions}{Require at most one sequence per panel unit
and occasion.}
}
\value{
An object of class \code{gp3_sequence_panel} containing canonical data,
a panel index, state levels, and mapping information.
}
\description{
Validates a collection of sequences observed repeatedly for the same panel
units and creates an auditable panel index. Each sequence must map to exactly
one panel unit and one occasion.
}
\examples{
panel <- data.frame(
  participant_id = rep(c("p1", "p2"), each = 8L),
  occasion = rep(rep(c(1, 2), each = 4L), times = 2L),
  sequence_id = rep(c("p1_w1", "p1_w2", "p2_w1", "p2_w2"), each = 4L),
  sequence_order = rep(1:4, times = 4L),
  state = c("A", "B", "C", "D", "A", "C", "C", "D",
            "D", "C", "B", "A", "D", "B", "B", "A")
)
prepare_sequence_panel(panel, "participant_id", "occasion")
}
