% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/data_conversion.R
\name{wide_to_long}
\alias{wide_to_long}
\title{Convert Wide Sequences to Long Format}
\usage{
wide_to_long(
  data,
  id_col = NULL,
  time_prefix = "V",
  action_col = "Action",
  time_col = "Time",
  drop_na = TRUE
)
}
\arguments{
\item{data}{Data frame in wide format with sequences in rows.}

\item{id_col}{Character. Name of the ID column, or NULL to auto-generate IDs.
Default: NULL.}

\item{time_prefix}{Character. Prefix for time point columns (e.g., "V" for V1,
V2, ...). Default: "V".}

\item{action_col}{Character. Name of the action column in output.
Default: "Action".}

\item{time_col}{Character. Name of the time column in output.
Default: "Time".}

\item{drop_na}{Logical. Whether to drop NA values. Default: TRUE.}
}
\value{
A data frame in long format with columns:
\describe{
\item{id}{Sequence identifier (integer).}
\item{Time}{Time point within the sequence (integer).}
\item{Action}{The action/state at that time point (character).}
}
Any additional columns from the original data are preserved.
}
\description{
Convert sequence data from wide format (one row per sequence, columns as
time points) to long format (one row per action).
}
\details{
This function converts data from the format produced by \code{simulate_sequences()}
to the long format used by many TNA functions and analyses.
}
\examples{
wide_data <- data.frame(
  V1 = c("A", "B", "C"), V2 = c("B", "C", "A"), V3 = c("C", "A", "B")
)
long_data <- wide_to_long(wide_data)
head(long_data)

}
\seealso{
\code{\link{long_to_wide}} for the reverse conversion,
\code{\link{prepare_for_tna}} for preparing data for TNA analysis.
}
