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

\item{id_col}{Character. Name of the column identifying sequences.
Default: "Actor".}

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

\item{action_col}{Character. Name of the column containing actions/states.
Default: "Action".}

\item{time_prefix}{Character. Prefix for time point columns in output.
Default: "V".}

\item{fill_na}{Logical. Whether to fill missing time points with NA.
Default: TRUE.}
}
\value{
A data frame in wide format where each row is a sequence and
columns V1, V2, ... contain the actions at each time point.
}
\description{
Convert sequence data from long format (one row per action) to wide format
(one row per sequence, columns as time points).
}
\details{
This function converts long format data (like that from \code{simulate_long_data()})
to the wide format expected by \code{tna::tna()} and related functions.

If \code{time_col} contains non-integer values (e.g., timestamps), the function
will use the ordering within each sequence to create time indices.
}
\examples{
long_data <- data.frame(
  Actor = rep(1:3, each = 4),
  Time = rep(1:4, 3),
  Action = sample(c("A", "B", "C"), 12, replace = TRUE)
)
wide_data <- long_to_wide(long_data, id_col = "Actor")
head(wide_data)

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