View source: R/inline_text.tbl_survfit.R
inline_text.tbl_survfit | R Documentation |
maturing
Extracts and returns statistics from a tbl_survfit
object for
inline reporting in an R markdown document. Detailed examples in the
inline_text vignette
## S3 method for class 'tbl_survfit'
inline_text(
x,
variable = NULL,
level = NULL,
pattern = NULL,
time = NULL,
prob = NULL,
column = NULL,
estimate_fun = x$inputs$estimate_fun,
pvalue_fun = label_style_pvalue(prepend_p = TRUE),
...
)
x |
( |
variable |
( |
level |
( |
pattern |
( |
time , prob |
( |
column |
( |
estimate_fun |
( |
pvalue_fun |
( |
... |
These dots are for future extensions and must be empty. |
A string reporting results from a gtsummary table
Daniel D. Sjoberg
library(survival)
# fit survfit
fit1 <- survfit(Surv(ttdeath, death) ~ trt, trial)
fit2 <- survfit(Surv(ttdeath, death) ~ 1, trial)
# sumarize survfit objects
tbl1 <-
tbl_survfit(
fit1,
times = c(12, 24),
label = ~"Treatment",
label_header = "**{time} Month**"
) %>%
add_p()
tbl2 <-
tbl_survfit(
fit2,
probs = 0.5,
label_header = "**Median Survival**"
)
# report results inline
inline_text(tbl1, time = 24, level = "Drug B")
inline_text(tbl1, time = 24, level = "Drug B",
pattern = "{estimate} [95% CI {conf.low}, {conf.high}]")
inline_text(tbl1, column = p.value)
inline_text(tbl2, prob = 0.5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.