Closed uriahf closed 3 years ago
Howdy! A generic confidence interval plot type is available. This allows for a basic version of a forest plot, whether raw CI or odds ratio.
https://jthomasmock.github.io/gtExtras/reference/gt_plt_conf_int.html
This is awsome! Is there any way to add an vertical reference line?
Thanks! There is not currently, I'm exploring ability to "cross rows" with a reference line, but it is more likely that a repeated vertical line will come first.
For me as a user a reference line is extremly important, otherwise it's difficult to compare visually the confidence interval to the baseline.
Thanks!
Latest version below, given the many methods to calculate a reference line it is up to the user to manually define a reference line that will be shared across rows.
library(dplyr, warn.conflicts = FALSE)
library(gtExtras)
ci_table <- generate_df(n = 50, n_grps = 3,
mean = c(10, 15, 20), sd = c(10, 10, 10),
with_seed = 37) %>%
dplyr::group_by(grp) %>%
dplyr::summarise(n = dplyr::n(),
avg = mean(values),
sd = sd(values),
list_data = list(values))
ci_table %>%
gt::gt() %>%
gt_plt_conf_int(list_data, ci = 0.9, ref_line = 14) %>%
gt::gtsave('test.png')
Created on 2021-10-25 by the reprex package (v2.0.1)
This is exactly what I needed, thanks!
I'm looking forward for this package to be in CRAN, it looks like a game changer to me!
I think that it would be extremely helpful to have a function for odds ratio visualization. I know that some alternatives exist (kable), but I can't find any solution for gt tables.