ggcuminc {ggsurvfit} | R Documentation |
Plot Cumulative Incidence
Description
Plot a cumulative incidence object created with tidycmprsk::cuminc()
or a multi-state object created with survfit2()
.
Read more on multi-state models here.
Usage
ggcuminc(
x,
outcome = NULL,
linetype_aes = FALSE,
theme = theme_ggsurvfit_default(),
...
)
Arguments
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 |
Value
a ggplot2 figure
Details
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.
See Also
Visit the gallery for examples modifying the default figures
Examples
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()