| ggcuminc | R Documentation | 
Plot a cumulative incidence object created with tidycmprsk::cuminc()
or a multi-state object created with survfit2().
Read more on multi-state models here.
ggcuminc(
  x,
  outcome = NULL,
  linetype_aes = FALSE,
  theme = theme_ggsurvfit_default(),
  ...
)
| x | a 'survfit' object created with  | 
| outcome | string indicating which outcome(s) to include in plot. Default is to include the first competing event. | 
| linetype_aes | logical indicating whether to add  | 
| theme | a survfit theme. Default is  | 
| ... | arguments passed to  | 
a ggplot2 figure
Why not use cmprsk::cuminc()?
The implementation of cmprsk::cuminc() does not provide the data required
to construct the risk table. Moreover, the tidycmprsk::cuminc() has a
user-friendly interface making it easy to learn and use.
Visit the gallery for examples modifying the default figures
library(tidycmprsk)
cuminc(Surv(ttdeath, death_cr) ~ trt, trial) %>%
  ggcuminc(outcome = "death from cancer") +
  add_confidence_interval() +
  add_risktable() +
  scale_ggsurvfit()
cuminc(Surv(ttdeath, death_cr) ~ trt, trial) %>%
  ggcuminc(outcome = c("death from cancer", "death other causes")) +
  add_risktable() +
  scale_ggsurvfit()
# using the survival multi-state model
survfit2(Surv(ttdeath, death_cr) ~ trt, trial) %>%
  ggcuminc(outcome = "death from cancer") +
  add_confidence_interval() +
  add_risktable() +
  scale_ggsurvfit()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.