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

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

See also

Author

Esther Drill, Daniel D. Sjoberg

Examples

# Example 1 ---------------------------------- add_q_ex1 <- trial[c("trt", "age", "grade", "response")] %>% tbl_summary(by = trt) %>% add_p() %>% add_q()
#> Adjusting p-values with #> `stats::p.adjust(x$table_body$p.value, method = "fdr")`
# Example 2 ---------------------------------- 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()
#> Global p-values for variable(s) `include = c("trt", "age", "grade")` were #> calculated with #> `car::Anova(mod = x$model_obj, type = "III")`
#> Adjusting p-values with #> `stats::p.adjust(x$table_body$p.value, method = "fdr")`