[R-meta] Help with Forest Plot – Avoiding Duplicate Display of Mean Difference and 95% CI

Emanuel Schembri |e||d26 @end|ng |rom gm@||@com
Sat Apr 19 11:08:02 CEST 2025


Dear Meta Group,

Wishing you all a happy Easter period!

I’m currently using the meta package and working on including risk of
bias plots within a forest plot, which I have been able to set up
successfully. However, I’ve encountered an issue: the mean difference
and 95% confidence interval are appearing twice within the forest plot
output.

I’ve attached the resulting forest plot and the R code I used.

Could anyone kindly advise how to prevent the mean difference and 95%
CI from appearing twice in the plot?

Many thanks in advance for your help!

Kind regards,
Emanuel





library(tidyverse)

library(meta)

library('readxl')

setwd("D:/abc/testROB")



E1 = read_xlsx("D:/abc/testROB/test.xlsx")

head(E1)

str(E1)





> dput(E1)

structure(list(study = c("A", "B", "C", "D", "E"), year = c(2000,

2001, 2002, 2003, 2004), n.mt = c(35, 10, 54, 22, 32), mean.mt = c(4.7,

4.01, 2.2, 5.25, 4.07), sd.mt = c(2.8, 0.26, 1.5, 1.52, 1.89),

    n.control = c(34, 10, 47, 21, 29), mean.control = c(5.7,

    8.8, 2.5, 6.3, 4.73), sd.control = c(2.5, 0.29, 1.22, 1.73,

    1.79), D1 = c("Low risk", "Some concerns", "Some concerns",

    "Low risk", "Low risk"), D2 = c("Some concerns", "High risk",

    "High risk", "Some concerns", "High risk"), D3 = c("Low risk",

    "Low risk", "Some concerns", "Low risk", "Some concerns"),

    D4 = c("Some concerns", "Some concerns", "High risk", "Some concerns",

    "High risk"), D5 = c("Low risk", "Low risk", "Low risk",

    "Low risk", "Low risk"), rob = c("Some concerns", "High risk",

    "High risk", "Some concerns", "High risk")), class = c("tbl_df",

"tbl", "data.frame"), row.names = c(NA, -5L))

>



# Meta-analysis

m.publ = metacont(n.mt,

                  mean.mt,

                  sd.mt,

                  n.control,

                  mean.control,

                  sd.control,

                  common = T,

                  random = T,

                  studlab = paste0(study, " (", year, ")"),

                  data = E1,

                  sm = "MD"

)



m2 <- rob(D1, D2, D3, D4, D5, overall = rob, data = m.publ, tool = "rob2")

rob(m2)



forest(m2,

       common = FALSE,

       test.overall.random = TRUE,

       prediction = TRUE,

       print.Q = TRUE,

       print.Q.pval = TRUE,

       digits.pval = 2,

       digits.sd = 1,

       digits.weight = 1,

       digits.mean = 1,

       label.left = "Favours Therapy",

       label.right = "Favours Control",

       cilayout("(", "; "),

       addrows = 1,

       just = "center",

       print.subgroup.name = FALSE,

       text.random.w = "Subtotal (95% CI)",

       label.e = "Therapy",

       label.c = "Control",

       layout = "RevMan5",

       text.random = "Total (95% CI)",

       text.w.random = "Random",

       text.predict = "95% Prediction Interval",

       col.label.right = "black",

       col.label.left = "black",

       xlim = c(-8, 5),

       xlab = " \n Post-treatment",

       ff.xlab = "bold"

)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: test plot rob.png
Type: image/png
Size: 33070 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-meta-analysis/attachments/20250419/7ec7db74/attachment-0001.png>


More information about the R-sig-meta-analysis mailing list