survfit2_p {ggsurvfit} | R Documentation |
Calculate p-value
Description
The function survfit2_p()
wraps survival::survdiff()
and returns
a formatted p-value.
Usage
survfit2_p(x, pvalue_fun = format_p, prepend_p = TRUE, rho = 0)
Arguments
x |
a 'survfit2' object |
pvalue_fun |
function to round and style p-value with |
prepend_p |
prepend |
rho |
argument passed to |
Value
a string
Examples
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)}"))
[Package ggsurvfit version 1.1.0 Index]