Bold values below a chosen threshold (e.g. <0.05)
in a gtsummary tables.
Usage
bold_p(x, t = 0.05, q = FALSE)
Arguments
- x
(gtsummary
)
Object created using gtsummary functions
- t
(scalar numeric
)
Threshold below which values will be bold. Default is 0.05.
- q
(scalar logical
)
When TRUE
will bold the q-value column rather
than the p-value. Default is FALSE
.
Author
Daniel D. Sjoberg, Esther Drill
Examples
# Example 1 ----------------------------------
trial |>
tbl_summary(by = trt, include = c(response, marker, trt), missing = "no") |>
add_p() |>
bold_p(t = 0.1)
Characteristic |
Drug A
N = 98 |
Drug B
N = 102 |
p-value |
---|
Tumor Response |
28 (29%) |
33 (34%) |
0.5 |
Marker Level (ng/mL) |
0.84 (0.23, 1.60) |
0.52 (0.18, 1.21) |
0.085 |
# Example 2 ----------------------------------
glm(response ~ trt + grade, trial, family = binomial(link = "logit")) |>
tbl_regression(exponentiate = TRUE) |>
bold_p(t = 0.65)
Characteristic |
OR |
95% CI |
p-value |
---|
Chemotherapy Treatment |
|
|
|
Drug A |
— |
— |
|
Drug B |
1.21 |
0.66, 2.24 |
0.5 |
Grade |
|
|
|
I |
— |
— |
|
II |
0.94 |
0.44, 1.98 |
0.9 |
III |
1.09 |
0.52, 2.27 |
0.8 |
Abbreviations: CI = Confidence Interval, OR = Odds Ratio |