The function survfit2_p()
wraps survival::survdiff()
and returns
a formatted p-value.
Arguments
- x
a 'survfit2' object
- pvalue_fun
function to round and style p-value with
- prepend_p
prepend
"p="
to formatted p-value- rho
argument passed to
survival::survdiff(rho=)
Examples
sf <- survfit2(Surv(time, status) ~ sex, data = df_lung)
sf %>%
ggsurvfit() +
add_confidence_interval() +
add_risktable() +
labs(caption = glue::glue("Log-rank {survfit2_p(sf)}"))
sf %>%
ggsurvfit() +
add_confidence_interval() +
add_risktable() +
annotate("text", x = 2, y = 0.05, label = glue::glue("{survfit2_p(sf)}"))