
Last chance! 50% off unlimited learning
Sale ends in
Lexis.diagram( age = c( 0, 60),
alab = "Age",
date = c( 1940, 2000 ),
dlab = "Calendar time",
int = 5,
lab.int = 2*int,
col.life = "black",
lwd.life = 2,
age.grid = TRUE,
date.grid = TRUE,
coh.grid = FALSE,
col.grid = gray(0.7),
lwd.grid = 1,
las = 1,
entry.date = NA,
entry.age = NA,
exit.date = NA,
exit.age = NA,
risk.time = NA,
birth.date = NA,
fail = NA,
cex.fail = 1.1,
pch.fail = c(NA,16),
col.fail = rep( col.life, 2 ),
data = NULL, ... )
fail
=0) and failures (fail
$\ne$0).entry.date
, exit.date
or
birth.date
are of class "Date
" or if any of the variables
entry.age
, exit.age
or risk.time
are of class
"difftime
", they will be converted to calendar years, and plotted
correctly in the diagram. The returned dataframe will then have colums of
classes "Date
" and "difftime
".Life.lines
,
Lexis.lines
Lexis.diagram( entry.age = c(3,30,45),
risk.time = c(25,5,14),
birth.date = c(1970,1931,1925.7),
fail = c(TRUE,TRUE,FALSE) )
LL <- Lexis.diagram( entry.age = sample( 0:50, 17, replace=TRUE ),
risk.time = sample( 5:40, 17, r=TRUE),
birth.date = sample( 1910:1980, 17, r=TRUE ),
fail = sample( 0:1, 17, r=TRUE ),
cex.fail = 1.1,
lwd.life = 2 )
# Identify the persons' entry and exits
text( LL$exit.date, LL$exit.age, paste(1:nrow(LL)), col="red", font=2, adj=c(0,1) )
text( LL$entry.date, LL$entry.age, paste(1:nrow(LL)), col="blue", font=2, adj=c(1,0) )
data( nickel )
attach( nickel )
LL <- Lexis.diagram( age=c(10,100), date=c(1900,1990),
entry.age=age1st, exit.age=ageout, birth.date=dob,
fail=(icd %in% c(162,163)), lwd.life=1,
cex.fail=0.8, col.fail=c("green","red") )
abline( v=1934, col="blue" )
nickel[1:10,]
LL[1:10,]
Run the code above in your browser using DataLab