inline_text.tbl_survival: Report statistics from survival summary tables inline

Description Usage Arguments Value pattern argument Author(s) Examples

View source: R/inline_text.R

Description

for inline reporting in an R markdown document.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## S3 method for class 'tbl_survival'
inline_text(
  x,
  strata = NULL,
  time = NULL,
  prob = NULL,
  pattern = "{estimate} ({conf.level*100}% CI {ci})",
  estimate_fun = NULL,
  ...
)

Arguments

x

Object created from tbl_survival

strata

If tbl_survival estimates are stratified, level of the stratum to report. Default is NULL when tbl_survival have no specified strata.

time

Time for which to return survival probability

prob

Probability for which to return survival time. For median survival use prob = 0.50

pattern

String indicating the statistics to return. Uses glue::glue formatting. Default is '{estimate} ({conf.level*100}% {ci})'. All columns from x$table_long are available to print as well as the confidence level (conf.level). See below for details.

estimate_fun

function to round/style estimate and lower/upper confidence interval estimates. Note, this does not style the 'ci' column, which is a string. Default is x$estimate_fun

...

Not used

Value

A string reporting results from a gtsummary table

pattern argument

The following items are available to print. Use print(x$table_long) to print the table the estimates are extracted from.

Author(s)

Karissa Whiting

Examples

1
2
3
4
5
6
7
8
9
library(survival)
surv_table <-
  survfit(Surv(ttdeath, death) ~ trt, trial) %>%
  tbl_survival(times = c(12, 24))

inline_text(surv_table,
  strata = "Drug A",
  time = 12
)

ddsjoberg/gtsummary documentation built on April 8, 2021, 5:48 a.m.