\Header{survSplit}{Split a survival data set at specified times}
\keyword{utilities}{survSplit}
\begin{Description}\relax
Given a survival data set and a set of specified cut times, split
each record into multiple subrecords at each cut time.  The new data
set will be in `counting process' format, with a start time, stop
time, and event status for each record.
\end{Description}
\begin{Usage}
\begin{verbatim}
survSplit(data, cut, end, event, start, id = NULL, zero = 0,
  episode=NULL)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{data}] data frame
\item[\code{cut}] vector of timepoints to cut at
\item[\code{end}] character string with name of event time variable 
\item[\code{event}] character string with name of censoring indicator 
\item[\code{start}] character string with name of start time variable (will
be created if it does not exist) 
\item[\code{id}] character string with name of new id variable to create (optional)
\item[\code{zero}] If \code{start} doesn't already exist, this is the time
that the original records start. May be a vector or single value.
\item[\code{episode}] character string with name of new episode variable (optional)
\end{ldescription}
\end{Arguments}
\begin{Value}
New, longer, data frame.
\end{Value}
\begin{SeeAlso}\relax
\code{\Link{Surv}}, \code{\Link{cut}}, \code{\Link{reshape}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
data(aml)
aml3<-survSplit(aml,cut=c(5,10,50),end="time",start="start",
      event="status",episode="i")

summary(aml)
summary(aml3)

coxph(Surv(time,status)~x,data=aml)
## the same
coxph(Surv(start,time,status)~x,data=aml3)

\end{ExampleCode}
\end{Examples}

