% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/data_conversion.R
\name{prepare_for_tna}
\alias{prepare_for_tna}
\title{Prepare Data for TNA Analysis}
\usage{
prepare_for_tna(
  data,
  type = c("sequences", "long", "auto"),
  state_names = NULL,
  id_col = "Actor",
  time_col = "Time",
  action_col = "Action",
  validate = TRUE
)
}
\arguments{
\item{data}{Data frame containing sequence data.}

\item{type}{Character. Type of input data:
\describe{
\item{"sequences"}{Wide format with one row per sequence (default).}
\item{"long"}{Long format with one row per action.}
\item{"auto"}{Automatically detect format based on column names.}
}}

\item{state_names}{Character vector. Expected state names, or NULL to
extract from data. Default: NULL.}

\item{id_col}{Character. Name of ID column for long format data.
Default: "Actor".}

\item{time_col}{Character. Name of time column for long format data.
Default: "Time".}

\item{action_col}{Character. Name of action column for long format data.
Default: "Action".}

\item{validate}{Logical. Whether to validate that all actions are in
state_names. Default: TRUE.}
}
\value{
A data frame ready for use with TNA functions. For "sequences" type,
returns a data frame where each row is a sequence and columns are time
points (V1, V2, ...). For "long" type, converts to wide format first.
}
\description{
Prepare simulated or real data for use with \code{tna::tna()} and related
functions. Handles various input formats and ensures the output is
compatible with TNA models.
}
\details{
This function performs several preparations:
\enumerate{
\item Converts long format to wide format if needed.
\item Validates that all actions/states are recognized.
\item Removes any non-sequence columns (e.g., id, metadata).
\item Converts factors to characters.
\item Ensures consistent column naming (V1, V2, ...).
}
}
\examples{
# From wide format sequences
sequences <- data.frame(
  V1 = c("A","B","C","A"), V2 = c("B","C","A","B"),
  V3 = c("C","A","B","C"), V4 = c("A","B","A","B")
)
tna_data <- prepare_for_tna(sequences, type = "sequences")

}
\seealso{
\code{\link{wide_to_long}}, \code{\link{long_to_wide}} for
format conversions.
}
