## -- Function to make huxtable from rms_model_results() df + col headers ------
make_modresults_ht <- function(resultsdf){
ht <- resultsdf %>%
hux() %>%
## Align variable name to left, all other columns to right
set_align(row = everywhere, col = everywhere, byrow = TRUE,
value = c("left", rep("right", ncol(resultsdf) - 1))) %>%
## Set p-value column to three decimal places by default
set_number_format(row = everywhere, col = 7, value = 3) %>%
## Bold column headers, add line after first row
set_bold(row = 1, col = everywhere, TRUE) %>%
set_bottom_border(row = 1, col = everywhere, value = 1) %>%
## Gray out all info except the row for history of depression, our main
## exposure of interest
set_text_color(
row = grep("^hx\\.depression$", resultsdf$label, invert = TRUE),
col = everywhere,
value = "#838383"
) %>%
## Table should take up 90% of document width
set_width(0.9)
}
Originally written for DelDepLTCI