Skip to content

Commit

Permalink
wip KM plots
Browse files Browse the repository at this point in the history
  • Loading branch information
Lpierott committed Nov 29, 2024
1 parent 4a0b3ee commit 80ac1fe
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions vignettes/kaplan_meier.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,28 @@ ds=df_colon %>%
print(ds)
```


# 2. Plot creation (use package ggsurvfit)

We recommend using the ggsurvfit package with the survfit2 function instead of survfit2 function.

Please follow the following link to obtain your kaplan Meier Curves
https://www.danieldsjoberg.com/ggsurvfit/articles/gallery.html

Kaplan-Meier by Daniel D. Sjoberg, Mark Baillie, Charlotta Fruechtenicht, Steven Haesendonckx, Tim Treis.

```{r}
survfit2(Surv(time, status) ~ surg, data = df_colon) %>%
ggsurvfit(linetype_aes = TRUE) +
add_confidence_interval() +
add_risktable(
risktable_stats = c("n.risk", "cum.censor", "cum.event")
) +
theme_ggsurvfit_KMunicate() +
scale_y_continuous(limits = c(0, 1)) +
scale_x_continuous(expand = c(0.02, 0)) +
theme(legend.position.inside = c(0.85, 0.85))
```


0 comments on commit 80ac1fe

Please sign in to comment.