Lexis
object (created by a call to
splitLexis
) divide the follow-up intervals into time bands
along a given time scale. The breaks
function returns
the break points, for a given time scale, and the timeBand
classifies each row (=follow-up interval) into one of the time bands.timeBand(lex, time.scale, type="integer")
breaks(lex, time.scale)
Lexis
breaks
function returns a vector of break points
for the Lexis
object, or NULL if no break points have been
defined by a call to splitLexis
. The timeBand
function returns a numeric vector or factor, depending on the value
of the type
argument.type
argument. The permitted values of the type
argument, and the corresponding return values are:
[object Object],[object Object],[object Object],[object Object],[object Object]Lexis
data(diet)
diet <- cal.yr(diet)
diet.lex <- Lexis(entry=list(period=doe),
exit=list(period=dox, age=dox-dob),
exit.status=chd,
data=diet)
diet.split <- splitLexis(diet.lex, breaks=seq(40,70,5), "age" )
age.left <- timeBand(diet.split, "age", "left")
table(age.left)
age.fact <- timeBand(diet.split, "age", "factor")
table(age.fact)
age.mid <- timeBand(diet.split, "age", "mid")
table(age.mid)
Run the code above in your browser using DataLab