Learn R Programming

Epi (version 2.58)

rm.tr: Remove transitions from a Lexis object.

Description

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.

Usage

rm.tr(obj, from, to)

Value

A Lexis object with the indicated transition removed.

Arguments

obj

A Lexis object.

from

Character; name of the state from which the transition to be purged originates. Must be a valid state name for obj.

to

Character; name of the state to which the transition to be purged targets. Must be a valid state name for obj.

Author

Bendix Carstensen, http://bendixcarstensen.com.

Details

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.

See Also

Relevel

Examples

Run this code
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" )

Run the code above in your browser using DataLab