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.



bailliem/visRam documentation built on Feb. 2, 2020, 12:04 a.m.