Learn R Programming

gtsummary (version 0.1.0)

inline_text.fmt_table1: Report statistics from fmt_table1 inline in an Rmarkdown document

Description

Report statistics from fmt_table1 inline in an Rmarkdown document

Usage

# S3 method for fmt_table1
inline_text(x, cell, sep = ":", pvalue = FALSE,
  p_pvalue = FALSE, overall = FALSE, ...)

Arguments

x

object of class fmt_table1 object from fmt_table1 function

cell

identifier for which cell to return from the fmt_table1 object

sep

a character string to separate the terms (e.g. variable name, )

pvalue

logical indicator to return p-value. Default is FALSE

p_pvalue

logical indicator to return p-value with prepended p (e.g. p=0.3 and p<0.001). Default is FALSE

overall

logical indicator to return overall summary statistic. Default is FALSE. This only applies when the fmt_table1 object contains both summary statistics by some variable AND overall summary statistics.

...

further arguments passed from generic inline_text()

Value

Formatted descriptive statistics from a fmt_table1 object

Examples

Run this code
# NOT RUN {
t1 <- fmt_table1(mtcars)
t2 <- fmt_table1(mtcars, by = "am")
t3 <- fmt_table1(mtcars, by = "am") %>% add_overall()

inline_text(t1, "mpg") # mpg
inline_text(t1, "cyl:4") # cyl=4
inline_text(t2, "mpg:1") # mpg with am=1
inline_text(t2, "cyl:4:1") # cyl=4 with am=1
inline_text(t3, "mpg", overall = TRUE) # overall mpg summary
# }

Run the code above in your browser using DataLab