gtsummary
gtsummary copied to clipboard
Missing CI in `add_ci()` for overall continuous variable after `add_overall()`
library(gtsummary)
packageVersion("gtsummary")
#> [1] '1.7.2'
mtcars |>
tbl_summary(
by = vs,
include = c(mpg, am)
) |>
add_overall() |>
add_ci() |>
as_kable()
#> ✖ `add_ci()` added mean CI for "mpg"; however, no mean is shown in the `tbl_summary()` table.
#> ✖ `add_ci()` added mean CI for "mpg"; however, no mean is shown in the `tbl_summary()` table.
Characteristic | Overall, N = 32 | 95% CI | 0, N = 18 | 95% CI | 1, N = 14 | 95% CI |
---|---|---|---|---|---|---|
mpg | 19.2 (15.4, 22.8) | 15.7 (14.8, 19.1) | 15, 19 | 22.8 (21.4, 29.6) | 21, 28 | |
am | 13 (41%) | 24%, 59% | 6 (33%) | 14%, 59% | 7 (50%) | 27%, 73% |
Created on 2023-11-11 with reprex v2.0.2
Since add_overall()
is a more general function, I would prefer to make this update in add_ci()
. add_ci()
will check if tbl_summary(by)
is specified and whether add_overall()
was called and include the appropriate CIs.
fix added in main
library(gtsummary)
packageVersion("gtsummary")
#> [1] '1.9.9.9000'
trial |>
tbl_summary(
by = trt,
include = response
) |>
add_overall() |>
add_ci() |>
as_kable()
Characteristic | Overall N = 200 | 95% CI | Drug A N = 98 | 95% CI | Drug B N = 102 | 95% CI |
---|---|---|---|---|---|---|
Tumor Response | 61 (32%) | 25%, 39% | 28 (29%) | 21%, 40% | 33 (34%) | 25%, 44% |
Unknown | 7 | 3 | 4 |
Created on 2024-06-29 with reprex v2.1.0