sort_p() orders the variables of a table by their p-value, smallest
first; filter_p() keeps the variables whose p-value is at or below a
threshold. A variable's p-value is the smallest p-value among its rows, so
the rows of a variable stay together.
Arguments
- x
(
ltsummary)
A table with ap.valuecolumn (or aq.valuecolumn whenq = TRUE).- q
(
scalar logical)
Whether to use the q-value column added byadd_q()rather than the p-value column. Default isFALSE.- t
(
scalar numeric)
Threshold forfilter_p(). Default is0.05.
Examples
# Example 1 ----------------------------------
trial |>
tbl_summary(by = trt, include = c(age, marker, grade, response)) |>
add_p() |>
sort_p()
# Example 2 ----------------------------------
glm(response ~ age + grade + trt + marker, trial, family = binomial) |>
tbl_regression(exponentiate = TRUE) |>
add_global_p() |>
filter_p(t = 0.5)