View source: R/extract-strata.R
extract_strata | R Documentation |
The tidied results of a survival object are in
extract_strata(tbl, column, ...)
tbl |
A table |
column |
Column to extract. Should be of the form |
... |
Extra arguments passed on to extract, such as This function is from David Robinson's |
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.