% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/expandRegimen.R
\name{expandRegimen}
\alias{expandRegimen}
\title{Expand regimen trajectory into long format}
\usage{
expandRegimen(data)
}
\arguments{
\item{data}{a data frame returned by \code{trial$get_locked_data()}.}
}
\value{
a long-format data frame: one row per regimen segment per patient,
with \code{regimen} and \code{switch_time_from_enrollment} appended and
\code{regimen_trajectory} removed.
}
\description{
Expands the compact \code{regimen_trajectory} column in locked data
(returned by \code{trial$get_locked_data()}) into a long-format data frame
with one row per regimen segment per patient.

The \code{regimen_trajectory} column stores each patient's treatment history
as a semicolon-separated string of \code{"name\@time"} entries, e.g.
\code{"placebo\@0;low dose\@8.5"}.  \code{expandRegimen} parses this into
two additional columns:
\itemize{
  \item \code{regimen} — name of the treatment regimen
  \item \code{switch_time_from_enrollment} — time from enrollment at which
        the patient switched to this regimen
}
The \code{regimen_trajectory} column is dropped from the result.
}
\examples{
\dontrun{
locked <- trial$get_locked_data('final')
long   <- expandRegimen(locked)
}

}
