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

add_q

Add a column of q-values to account for multiple comparisons


Description

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

Usage

add_q(x, method = "fdr", pvalue_fun = NULL, quiet = NULL)

Arguments

x

a gtsummary 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)).

quiet

Logical indicating whether to print messages in console. Default is FALSE

Example Output

Example 1

Example 2

Author(s)

Esther Drill, Daniel D. Sjoberg

See Also

Examples

# Example 1 ----------------------------------
add_q_ex1 <-
  trial[c("trt", "age", "grade", "response")] %>%
  tbl_summary(by = trt) %>%
  add_p() %>%
  add_q()

# Example 2 ----------------------------------
if (requireNamespace("car")) {
  add_q_ex2 <-
    trial[c("trt", "age", "grade", "response")] %>%
    tbl_uvregression(
      y = response,
      method = glm,
      method.args = list(family = binomial),
      exponentiate = TRUE
    ) %>%
    add_global_p() %>%
    add_q()
}

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.