Description Usage Arguments Details Value Examples
Find features of a spell that are useful for estimating survival models with interval censored observations
1 | spell_features(df, var, group, right_censored = TRUE)
|
df |
data frame with the spell variable |
var |
character string specifying the variable in |
group |
character string specifying a group variable (if any) to find spell features within groups. |
right_censored |
logical. If |
Note: assumes that var
is in time order and that observations
are equally spaced in time.
Four columns in addition to the original data frame of the
spell_id
, a binary spell_event
variable, as well as
spell_time1
and spell_time2
with the interval start and
end times within each spell.
1 2 3 4 5 6 7 8 9 10 | # Create fake data
group_id <- c(rep('aa', 7), rep('bb', 4))
x <- c(rep('a', 4), rep('b', 3), 'c', rep('a', 2), 'c')
fake_data <- data.frame(group_id = group_id, spell = x)
# Find spell features
spell_features(fake_data, var = 'spell')
spell_features(fake_data, var = 'spell', group = 'group_id')
spell_features(fake_data, var = 'spell', group = 'group_id',
right_censored = FALSE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.