library(Epi)
x <- Lexis(data=sire[1000:1100],
entry = list(fot=0, per=get.yrs(dg_date), age=dg_age),
exit=list(per=get.yrs(ex_date)), exit.status=status)
BL <- list(fot=seq(0, 5, by = 3/12), per=c(2008, 2013))
x2 <- splitMulti(x, breaks = BL, drop = FALSE)
x3 <- splitLexisDT(x, breaks = BL$fot, timeScale = "fot", drop = FALSE)
x3 <- splitLexisDT(x3, breaks = BL$per, timeScale = "per", drop = FALSE)
x4 <- splitLexis(x, breaks = BL$fot, time.scale = "fot")
x4 <- splitLexis(x4, breaks = BL$per, time.scale = "per")
## all produce identical results
Run the code above in your browser using DataLab