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

Orestis Efthimiou orem|ou @end|ng |rom gm@||@com
Wed Apr 23 08:59:06 CEST 2025


Hi Emanuel,

You just need to add this in the forest function
leftcols=c("studlab", "n.e", "mean.e", "sd.e", "n.c", "mean.c", "sd.c")

Best,
Orestis

On Sat, Apr 19, 2025 at 11:08 AM Emanuel Schembri via R-sig-meta-analysis <
r-sig-meta-analysis using r-project.org> wrote:

> 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"
>
> )
> _______________________________________________
> R-sig-meta-analysis mailing list @ R-sig-meta-analysis using r-project.org
> To manage your subscription to this mailing list, go to:
> https://stat.ethz.ch/mailman/listinfo/r-sig-meta-analysis
>

	[[alternative HTML version deleted]]



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