在 gtsummary 包中将呈现的 OR 的位数和 95% CI 增加 tbl_regression

Increase number of digits on presented ORs and 95% CI by tbl_regression in gtsummary package

如何增加取幂 OR 的位数并将其从默认的 2 位对应的 95% CI 增加到 3 位?

library(gtsummary)
data(trial)
  glm(response ~ trt, trial, family = binomial) %>%
  tbl_regression(exponentiate = TRUE)
res <- glm(response ~ trt, trial, family = binomial) %>%
          tbl_regression(exponentiate = TRUE) %>% style_sigfig( digits = 3)
#Error in abs(x) : non-numeric argument to mathematical function

expoentiateFALSE时,我们可以修改style_sigfig,如果是TRUE,则修改[=16=中的digits ] 如 `?tbl_regression

中所述

estimate_fun - Function to round and format coefficient estimates. Default is style_sigfig when the coefficients are not transformed, and style_ratio when the coefficients have been exponentiated.

默认都是2.

library(gtsummary)
library(dplyr)
glm(response ~ trt, trial, family = binomial) %>%
      tbl_regression(exponentiate = TRUE, 
        estimate_fun = purrr::partial(style_ratio, digits = 3),
         pvalue_fun = purrr::partial(style_sigfig, digits = 3))