Description Usage Arguments Details Value Examples
View source: R/survival_define.R
combine multiple columns into a survival table
1 2 3 4 5 6 7 | define_wtd_surv_table(x, time_col, weights, by_age)
## S3 method for class 'character'
define_wtd_surv_table(x, time_col, weights, by_age)
## S3 method for class 'data.frame'
define_wtd_surv_table(x, time_col, weights, by_age)
|
x |
a data frame, or a string pointing to such a data frame |
time_col |
the column of x measuring time |
weights |
a named vector of weights. Names correspond to
the columns of |
by_age |
is time in the table measured by age instead of cycle (as is typical for a mortality table, for example). |
weights
are not checked for adding to 1.
a surv_pooled
object (see mix()
).
1 2 3 4 5 6 7 8 | df <- data.frame(age = c(50, 55, 60, 65),
male = c(1, 0.9, 0.8, 0.7),
female = c(1, 0.8, 0.7, 0.6)
)
wtd_table <-
define_wtd_surv_table(df, time_col = "age",
weights = c(male = 0.52, female = 0.48),
by_age = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.