#create wide data
wideexample <- ctLongToWide(datalong = ctstantestdat, id = "id",
time = "time", manifestNames = c("Y1", "Y2"),
TDpredNames = "TD1", TIpredNames = c("TI1", "TI2","TI3"))
wide <- ctIntervalise(datawide = wideexample, Tpoints = 10, n.manifest = 2,
n.TDpred = 1, n.TIpred = 3, manifestNames = c("Y1", "Y2"),
TDpredNames = "TD1", TIpredNames = c("TI1", "TI2","TI3") )
#Then convert to long format
longexample <- ctWideToLong(datawide = wideexample, Tpoints=10,
n.manifest=2, manifestNames = c("Y1", "Y2"),
n.TDpred=1, TDpredNames = "TD1",
n.TIpred=3, TIpredNames = c("TI1", "TI2","TI3"))
#Then convert the time intervals to absolute time
long <- ctDeintervalise(datalong = longexample, id='id', dT='dT')
head(long,22)
Run the code above in your browser using DataLab