rm.tr: Remove transitions from a Lexis object.

View source: R/rm.tr.R

rm.trR Documentation

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)

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.

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.

Value

A Lexis object with the indicated transition removed.

Author(s)

Bendix Carstensen, http://bendixcarstensen.com.

See Also

Relevel

Examples

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" )

Epi documentation built on March 19, 2024, 3:07 a.m.

Related to rm.tr in Epi...