Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

inline_text.tbl_survival

Report statistics from survival summary tables inline


Description

[Deprecated] for inline reporting in an R markdown document.

Usage

## 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.

  • {label} 'time' or 'prob' label

  • {estimate} survival or survival time estimate formatted with 'estimate_fun'

  • {conf.low} lower limit of confidence interval formatted with 'estimate_fun'

  • {conf.high} upper limit of confidence interval formatted with 'estimate_fun'

  • {ci} confidence interval formatted with x$estimate_fun (pre-formatted)

  • {time}/{prob} time or survival quantile (numeric)

  • {n.risk} number at risk at 'time' (within stratum if applicable)

  • {n.event} number of observed events at 'time' (within stratum if applicable)

  • {n} number of observations (within stratum if applicable)

  • {variable} stratum variable (if applicable)

  • {level} stratum level (if applicable )

  • {groupname} label_level from original tbl_survival() call

Author(s)

Karissa Whiting

Examples

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
)

gtsummary

Presentation-Ready Data Summary and Analytic Result Tables

v1.4.0
MIT + file LICENSE
Authors
Daniel D. Sjoberg [aut, cre] (<https://orcid.org/0000-0003-0862-2018>), Michael Curry [aut] (<https://orcid.org/0000-0002-0261-4044>), Margie Hannum [aut] (<https://orcid.org/0000-0002-2953-0449>), Joseph Larmarange [aut] (<https://orcid.org/0000-0001-7097-700X>), Karissa Whiting [aut] (<https://orcid.org/0000-0002-4683-1868>), Emily C. Zabor [aut] (<https://orcid.org/0000-0002-1402-4498>), Esther Drill [ctb] (<https://orcid.org/0000-0002-3315-4538>), Jessica Flynn [ctb] (<https://orcid.org/0000-0001-8310-6684>), Jessica Lavery [ctb] (<https://orcid.org/0000-0002-2746-5647>), Stephanie Lobaugh [ctb], Gustavo Zapata Wainberg [ctb] (<https://orcid.org/0000-0002-2524-3637>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.