spell_event: Mark changes in spells as events

Description Usage Arguments Value Examples

Description

Mark changes in spells as events

Usage

1
spell_event(x, right_censored = TRUE)

Arguments

x

a time ordered vector with values identifying a spell. It is assumed that when a value in this vector changes that the spell has ended.

right_censored

logical. If TRUE the final observation is treated as right-censored, i.e. coded as 0. If FALSE the the final observation is treated as an event.

Value

a vector of event codes for each observation in x. 0 indicates that there was no spell change. 1 indicates a spell change.

Examples

1
2
3
x <- c(rep('a', 4), rep('b', 3), 'c', rep('a', 2), 'c')
spell_event(x)
spell_event(x, right_censored = FALSE)

christophergandrud/SurvSetup documentation built on May 13, 2019, 7:01 p.m.