# NOT RUN {
data<-dataexamples(n=1000,seed=3456,Censoring=TRUE)$datagest
#To demonstrate the function we
#Delete the third row, corresponding to the entry for ID 1 at time 3
data<-data[-3,]
datanew<-FormatData(data=data,idvar="id",timevar="time",An="A",
varying=c("A","L"),GenerateHistory=FALSE,GenerateHistoryMax=NA)
head(datanew)
#Note that the missing entry has been re-added,
#with missing values for A and L in the third row
#An example with lagged history of time varying variables created.
data<-dataexamples(n=1000,seed=3456,Censoring=TRUE)$datagestmultcat
datanew<-FormatData(data=data,idvar="id",timevar="time",An="A",
Cn="C",varying=c("A","L"),GenerateHistory=TRUE,GenerateHistoryMax=NA)
head(datanew)
# }
Run the code above in your browser using DataLab