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

inline_text.tbl_uvregression

Report statistics from regression summary tables inline


Description

Extracts and returns statistics from a table created by the tbl_uvregression function for inline reporting in an R markdown document. Detailed examples in the inline_text vignette

Usage

## S3 method for class 'tbl_uvregression'
inline_text(
  x,
  variable,
  level = NULL,
  pattern = "{estimate} ({conf.level*100}% CI {conf.low}, {conf.high}; {p.value})",
  estimate_fun = NULL,
  pvalue_fun = NULL,
  ...
)

Arguments

x

Object created from tbl_uvregression

variable

Variable name of statistics to present

level

Level of the variable to display for categorical variables. Default is NULL, returning the top row in the table for the variable.

pattern

String indicating the statistics to return. Uses glue::glue formatting. Default is "{estimate} ({conf.level }% CI {conf.low}, {conf.high}; {p.value})". All columns from x$table_body are available to print as well as the confidence level (conf.level). See below for details.

estimate_fun

function to style model coefficient estimates. Columns 'estimate', 'conf.low', and 'conf.high' are formatted. Default is x$inputs$estimate_fun

pvalue_fun

function to style p-values and/or q-values. Default is function(x) style_pvalue(x, prepend_p = TRUE)

...

Not used

Value

A string reporting results from a gtsummary table

pattern argument

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

  • {estimate} coefficient 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'

  • {p.value} p-value formatted with 'pvalue_fun'

  • {N} number of observations in model

  • {label} variable/variable level label

Author(s)

Daniel D. Sjoberg

See Also

Examples

inline_text_ex1 <-
  trial[c("response", "age", "grade")] %>%
  tbl_uvregression(
    method = glm,
    method.args = list(family = binomial),
    y = response,
    exponentiate = TRUE
  )

inline_text(inline_text_ex1, variable = age)
inline_text(inline_text_ex1, variable = grade, level = "III")

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.