I am currently running the syntax below and am wondering whether it is possible to report the confidence intervals to 4 decimal places?
library(survey)
library(gtsummary)
data(api, package = "survey")
svydesign(id = ~dnum, weights = ~pw, data = apiclus1, fpc = ~fpc) |>
tbl_svysummary(
by = "both",
include = c(api00, stype),
statistic = all_continuous() ~ "{mean} ({sd})"
) |>
add_stat_label() |>
add_ci(pattern = "{stat} (95% CI {ci})") |>
modify_header(all_stat_cols() ~ "**{level}**") |>
modify_spanning_header(all_stat_cols() ~ "**Survived**")
See https://github.com/ddsjoberg/gtsummary/issues/1141:
The answer adjusted accordingly to Daniel's comment :)
[...]
my_style <- label_style_number(digits = 4, scale = 100)
survey::svydesign(id = ~dnum, weights = ~pw, data = apiclus1, fpc = ~fpc) |>
tbl_svysummary(
by = "both",
include = c(api00, stype),
statistic = all_continuous() ~ "{mean} ({sd})"
) |>
add_stat_label() |>
add_ci(pattern = "{stat} (95% CI {ci})",
style_fun = list(all_categorical() ~ my_style)
) |>
modify_header(all_stat_cols() ~ "**{level}**") |>
modify_spanning_header(all_stat_cols() ~ "**Survived**")