survfit2_p | R Documentation |
The function survfit2_p()
wraps survival::survdiff()
and returns
a formatted p-value.
survfit2_p(x, pvalue_fun = format_p, prepend_p = TRUE, rho = 0)
x |
a 'survfit2' object |
pvalue_fun |
function to round and style p-value with |
prepend_p |
prepend |
rho |
argument passed to |
a string
sf <- survfit2(Surv(time, status) ~ sex, data = df_lung)
sf %>%
ggsurvfit() +
add_confidence_interval() +
add_risktable() +
scale_ggsurvfit() +
labs(caption = glue::glue("Log-rank {survfit2_p(sf)}"))
sf %>%
ggsurvfit() +
add_confidence_interval() +
add_risktable() +
scale_ggsurvfit() +
annotate("text", x = 2, y = 0.05, label = glue::glue("{survfit2_p(sf)}"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.