rm.tr | R Documentation |
Sometimes certain transitions are not of interest. This function removes these and assigns the risk time in the target state of the transitions to the originating state.
rm.tr(obj, from, to)
obj |
A |
from |
Character; name of the state from which the transition to be purged
originates. Must be a valid state name for |
to |
Character; name of the state to which the transition to be purged
targets. Must be a valid state name for |
The function removes all transitions from from
to to
, and
assigns all risk time in the to
state after the transition
(lex.dur
) to the from
state. This is only done for risk
time in to
occurring directly after from
. Risk time in
to
occurring after a transition from states different from
from
is not affected. Transitions from to
to another
state, other
, say, will be changed to transitions from
from
to other
.
A Lexis
object with the indicated transition removed.
Bendix Carstensen, http://bendixcarstensen.com.
Relevel
data(DMlate)
dml <- Lexis( entry = list(Per=dodm, Age=dodm-dobth, DMdur=0 ),
exit = list(Per=dox),
exit.status = factor(!is.na(dodth),labels=c("DM","Dead")),
data = DMlate )
# A small subset for illustration
dml <- subset( dml, lex.id %in% c(13,15,20,28,40) )
# Cut the follow-up at start of insulin therapy
dmi <- cutLexis( dml, cut = dml$doins,
pre = "DM",
new.state = "Ins" )[,1:10]
# How does it look?
dmi
# Remove all transitions DM -> Ins
rm.tr( dmi, "DM", "Ins" )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.