# NOT RUN {
( Life.lines( entry.age = c(3,30,45),
risk.time = c(25,5,14),
birth.date = c(1970,1931,1925.7) ) )
# Draw a Lexis diagram
Lexis.diagram()
# Compute entry and exit age and date.
( LL <- Life.lines( entry.age = c(3,30,45),
risk.time = c(25,5,14),
birth.date = c(1970,1931,1925.7) ) )
segments( LL[,1], LL[,2], LL[,3], LL[,4] ) # Plot the life lines.
# Compute entry and exit age and date, supplying a date variable
bd <- ( c(1970,1931,1925.7) - 1970 ) * 365.25
class( bd ) <- "Date"
( Life.lines( entry.age = c(3,30,45),
risk.time = c(25,5,14),
birth.date = bd ) )
# }
Run the code above in your browser using DataLab