% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/parse_formula.R
\name{parse_msm_formula}
\alias{parse_msm_formula}
\title{Parse a patp Formula into Validated Interval Data}
\usage{
parse_msm_formula(formula, data, id, cluster = NA)
}
\arguments{
\item{formula}{A formula. LHS must be a call to \code{msm()}; RHS
must be either \code{1} (one-sample) or a single variable name
(two-sample).}

\item{data}{A data frame to evaluate the formula in.}

\item{id}{Character. Name of the subject ID column in \code{data}.
Required.}

\item{cluster}{Character or \code{NA}. Name of the cluster ID column
in \code{data}. \code{NA} means no clustering (individual-level
bootstrap).}
}
\value{
A list with elements:
\itemize{
  \item \code{data}: a data frame with columns \code{id}, \code{Tstart},
    \code{Tstop}, \code{Sstart}, \code{Sstop}, plus \code{cluster} if
    supplied and \code{group} if the formula has an RHS.
  \item \code{group}: \code{NULL} (one-sample) or a vector aligned with
    the rows of \code{data} (two-sample).
  \item \code{has_cluster}: logical, whether a cluster column was
    supplied.
}
}
\description{
Internal helper. Takes a formula of the form
\code{msm(Tstart, Tstop, Sstart, Sstop) ~ 1} or
\code{msm(Tstart, Tstop, Sstart, Sstop) ~ group_var}, plus a data
frame and ID column names, and returns a list with the assembled
interval data and an optional grouping vector.
}
\keyword{internal}
