Description Usage Arguments Examples
View source: R/extract-strata.R
The tidied results of a survival object are in
1 | extract_strata(tbl, column, ...)
|
tbl |
A table |
column |
Column to extract. Should be of the form |
... |
Extra arguments passed on to extract, such as |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | library(survival)
library(broom)
surv_td <- survfit(Surv(stop - start, status) ~ sex + pcdx,
data = mgus1) %>%
tidy()
surv_td
# Extract into "sex" and "pcdx" columns
surv_fit %>%
extract_strata(strata)
# Now visualize, separating by strata
library(ggplot2)
surv_fit %>%
extract_strata(strata) %>%
ggplot(aes(time, estimate, color = sex)) +
geom_line() +
geom_ribbon(aes(ymin = conf.low, ymax = conf.high), alpha = .25) +
facet_wrap(~ pcdx)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.