Learn R Programming

gtsummary (version 1.2.1)

add_q.tbl_summary: Add a column of q-values to account for multiple comparisons

Description

Adjustments to are p-values are performed with stats::p.adjust.

Usage

# S3 method for tbl_summary
add_q(x, method = "fdr",
  pvalue_fun = x$pvalue_fun, ...)

Arguments

x

tbl_summary object

method

String indicating method to be used for p-value adjustment. Methods from stats::p.adjust are accepted. Default is method = 'fdr'.

pvalue_fun

Function to round and format p-values. Default is style_pvalue. The function must have a numeric vector input (the numeric, exact p-value), and return a string that is the rounded/formatted p-value (e.g. pvalue_fun = function(x) style_pvalue(x, digits = 2) or equivalently, purrr::partial(style_pvalue, digits = 2)).

...

Additional arguments passed to or from other methods

Value

A tbl_summary object

Example Output

See Also

Other tbl_summary tools: add_n, add_overall, add_p, add_stat_label, bold_italicize_labels_levels, bold_p.tbl_summary, inline_text.tbl_summary, modify_header, sort_p.tbl_summary, tbl_summary

Examples

Run this code
# NOT RUN {
tbl_sum_q_ex <-
  trial %>%
  dplyr::select(trt, age, grade, response) %>%
  tbl_summary(by = trt) %>%
  add_p() %>%
  add_q()
# }

Run the code above in your browser using DataLab