knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(visRam)
library(survival) library(magrittr) library(dplyr) library(ggplot2) library(broom) library(patchwork) fit <- survfit(Surv(time, status) ~ sex, data = lung) a <- fit %>% tidy() %>% autoplot_surv() a
Display risk table
b <- autotab_risk(fit, 500) %>% ggplot(aes(x = time, y = strata, label = n.risk)) + geom_text() b
a / b
TODO: How to add to displayed ggplot object. ggproto? e.g. add facetting by strata.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.