Description Usage Arguments Value Functions Examples
View source: R/censored-formats.R
censored times might already be of the 'Surv' class, or where the 'time' and 'event' components of such a class is stored separately, either way this is a function to transition between these two formats
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
data |
the data, a data frame or some such object |
id |
is there an identifiction variable that should remain in the data set |
toSurv |
logical; resulting variables to be of class 'Surv'? |
.fix |
named vector of pre- or suffix that identifies the 'time' and 'event'-variables (names must contain "time" and "event") |
suffix |
is .fix a suffix? |
a data frame
surv_pair2Surv
: transition from separate variables to class 'Surv'
Surv2surv_pair
: transition from class 'Surv' to separate variables
1 2 3 4 5 6 | df <- data.frame(
persnr = sprintf("id%s", 1:10),
t.arg = rexp(10, 1/50),
ev.arg = rbinom(10, 1, 0.7)
)
surv_converter(df, id = "persnr")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.