I'm trying to use the forestplot package to include estimate (beta) values. I can do it just fine if I were to use means instead of estimates using the code below:
library(forestplot)
library(dplyr)
tabletext <- cbind(c("", "Group", "A", "At 1M", "At 3M", "At 6M", "B", "A1 1M", "At 3M", "At 6M", "C", "At 1M", "At 3M", "At 6M"),
c("Mean", "", "", "0.11", "0.11", "0.0062", "", "0.17", "0.24", "0.22", "", "0.081", "0.11", "0.014"),
c("Lower CI", "", "", "0.22", "0.28", "0.48", "", "0.16", "0.17", "0.26", "", "0.26", "0.27", "0.51"),
c("Upper CI", "", "", "0.45", "0.51", "0.49", "", "0.52", "0.64", "0.71", "", "0.43", "0.69", "0.48"))
fp <- structure(list(mean = c(NA, NA, NA, 0.11, 0.11, 0.0062, NA, 0.17, 0.24, 0.22, NA, 0.081, 0.11, 0.014),
lower = c(NA, NA, NA, 0.22, 0.28, 0.48, NA, 0.16, 0.17, 0.26, NA, 0.26, 0.27, 0.51),
upper = c(NA, NA, NA, 0.45, 0.51, 0.49, NA, 0.52, 0.64, 0.71, NA, 0.43, 0.69, 0.48)),
.Names = c("mean", "lower", "upper"),
row.names = c(NA, -14L),
class = "data.frame")
fp2<-fp %>%
forestplot(labeltext = tabletext,
clip = c(0.005, 1),
xlog = TRUE,
col = fpColors(box = "royalblue",
line = "darkblue"))
However, I'm not quite sure how to modify the code to use estimates instead. The code above doesn't work for estimates because some of my values are negative. I'm trying to get an outcome similar to the figure I have attached. Any help would be greatly appreciated!
