rcutLexis: A function to cut follow-up at intermediate event times.

Description Usage Arguments Value Author(s) See Also Examples

View source: R/rcutLexis.R

Description

Cuts follow-up at intermediate event times, multiple events per person are allowed, as well as recurrences of the sme type of event. The resulting states only refer to the last assumed state, unlike the result from mcutLexis.

Usage

1
2
3
rcutLexis( Lx, cut,
    timescale = 1,
    precursor.states = transient(Lx))

Arguments

Lx

A Lexis object to be amended,.

cut

A data frame with columns lex.id, cut (event times) and new.state (event type, character)

timescale

What time scale do values in cut$cut refer to. Numeric or character.

precursor.states

an optional vector of states to be considered as "less severe" than new.state. See Details in the documentation of cutLexis

Value

A Lexis object with follow-up cut at the event times supplied in cut

Author(s)

Bendix Carstensen, http://bendixcarstensen.com

See Also

cutLexis, mcutLexis, addCov.Lexis, Lexis, splitLexis

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
df <- data.frame(lex.id = rep(c(3, 7), c(3, 5)))
df$new.state <- sample(LETTERS[2:4], 8, r = TRUE) 
df$cut <- round(runif(8) * 100) + 1
df

Lx <- Lexis( exit = list(time=c(89, 97)),
               id = c(3, 7),
      exit.status = factor(c("A", "X")) )
Lx 
rcutLexis(Lx, df, pre = "A")
        

Epi documentation built on Feb. 28, 2021, 1:06 a.m.

Related to rcutLexis in Epi...