Thanks for the great package. I have a question about the bolding function. Would it be possible to add a function such as "bolding significant variables", if and when you have time ? I am not sure if this can be done currently. Many times we do not report p-values alone. I think it would be useful to bold levels/variables that are statistically significant (the point estimate, CI, and p-value). I did not know where to post such a request. I hope it is ok to do so here.
Have a great day !
You can have finer control over how the table is styled using the modify_table_styling()
function. Example below!
library(gtsummary)
packageVersion("gtsummary")
#> [1] '1.7.1'
trial |>
tbl_summary(
include = c(age, stage),
missing = "no",
by = trt
) |>
add_p() |>
modify_table_styling(
column = label,
rows = p.value < 0.8, # change this threshold to 0.05 for the standard levels of significance,
text_format = "bold"
) |>
as_kable() # convert to kable to display on stack overflow
Characteristic | Drug A, N = 98 | Drug B, N = 102 | p-value |
---|---|---|---|
Age | 46 (37, 59) | 48 (39, 56) | 0.7 |
T Stage | 0.9 | ||
T1 | 28 (29%) | 25 (25%) | |
T2 | 25 (26%) | 29 (28%) | |
T3 | 22 (22%) | 21 (21%) | |
T4 | 23 (23%) | 27 (26%) |
Created on 2023-05-08 with reprex v2.0.2