Report statistics from fmt_table1 inline in an Rmarkdown document

# 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

t1 <- fmt_table1(mtcars) t2 <- fmt_table1(mtcars, by = "am") t3 <- fmt_table1(mtcars, by = "am") %>% add_overall() inline_text(t1, "mpg") # mpg
#> [1] "19.2 (15.4, 22.8)"
inline_text(t1, "cyl:4") # cyl=4
#> [1] "11 (34%)"
inline_text(t2, "mpg:1") # mpg with am=1
#> [1] "22.8 (21.0, 30.4)"
inline_text(t2, "cyl:4:1") # cyl=4 with am=1
#> [1] "8 (62%)"
inline_text(t3, "mpg", overall = TRUE) # overall mpg summary
#> [1] "19.2 (15.4, 22.8)"