简体   繁体   English

如何使用Metafor / R清除Forest Plot中的预打印文本?

[英]How do I get rid off pre-printed text in Forest Plot using Metafor/R?

I am using the Metafor package to produce meta-analysis and subsequently a Forest Plot. 我正在使用Metafor软件包进行荟萃分析,然后进行森林图。 When I print my Forest Plot a "RE Model"-text appears automatically as shown on the attached print. 当我打印森林图时,将自动显示“ RE模型”文本,如所附打印所示。 I can't figure out how to remove the "RE Model" although I use a separate text-script. 尽管我使用单独的文本脚本,但我不知道如何删除“ RE模型”。 I just want my "own" text to appear aligned with the polygon. 我只希望“自己的”文本与多边形对齐。 Can you help? 你能帮我吗?

在此处输入图片说明

First "load data" and then my script: 首先“加载数据”,然后是我的脚本:

### Load data
dat <- structure(list(study = structure(c(4L, 5L, 3L, 1L, 2L, 7L, 6L
), .Label = c("Battaglia et al.", "Hong et al.", "Kosyakove et al.", 
          "Lim et al.", "Rauch et al.", "Swachia et al.", "Tsounis et 
al."
), class = "factor"), n1i = c(20L, 121L, 25L, 18L, 31L, 35L, 
                          22L), m1i = c(12.8, 30.2, 24.6, 21, 25, 27, 
18.2), sd1i = c(15.4, 

21.6, 17, 33, 18, 13.8, 8.72), n2i = c(20L, 129L, 25L, 17L, 32L, 

34L, 20L), m2i = c(12.1, 28.7, 25.1, 31, 26, 28.6, 14.7), sd2i = c(14.6, 

21.6, 12.2, 25, 19, 24.2, 12.9), ntotal = c(40L, 250L, 50L, 35L, 

63L, 69L, 42L), mean.age = c(3L, 3L, 1L, 4L, 4L, 3L, 3L), demograhic = 
c(0L, 

2L, 1L, 1L, 0L, 1L, 0L), adjusted.comorbid = c(1L, 1L, 1L, 1L, 

0L, 1L, 1L), follow.up = c(1L, 3L, 3L, 1L, 2L, 2L, 2L), severity = c(2L, 

4L, 1L, 4L, 4L, 4L, 4L), treat.sys = c(1L, 2L, 1L, 2L, 1L, 2L, 

1L), treat.int = c(1L, 1L, 2L, 1L, 2L, 1L, 1L), year = c(2000L, 

2000L, 2000L, 2000L, 2000L, 2000L, 2000L), citation = c(1L, 2L, 

3L, 4L, 5L, 6L, 6L), yi = structure(c(0.700000000000001, 1.5, 

-0.5, -10, -1, -1.6, 3.5), measure = "MD", ni = c(40L, 250L, 

50L, 35L, 63L, 69L, 42L)), vi = c(22.516, 7.47261195464155, 17.5136, 

97.2647058823529, 21.7328629032258, 22.6658487394958, 11.7767909090909

)), .Names = c("study", "n1i", "m1i", "sd1i", "n2i", "m2i", "sd2i", 

"ntotal", "mean.age", "demograhic", "adjusted.comorbid", "follow.up", 

"severity", "treat.sys", "treat.int", "year", "citation", "yi", 

"vi"), row.names = c(NA, -7L), class = c("escalc", "data.frame"

), digits = 4, yi.names = "yi", vi.names = "vi")

AND my code 和我的代码

### My code
res <- rma(yi, vi, data=dat, slab=paste(study, year, citation, sep=", "), method = "REML")
forest(res, xlim=c(-39,24), at=c(-12,-9,-6,-3,0,3,6,9,12), showweights = TRUE,
   ilab=cbind(dat$m1i, dat$n1i, dat$sd1i, dat$m2i, dat$n2i, dat$sd2i),
   ilab.xpos=c(-26,-24,-22,-18,-16,-14), cex=1, ylim=c(-2, 10), font=1, digits=2, col="darkgrey")

### Add own text
 text(-39, -2, pos=4, cex=0.9, font=2, 
 bquote(paste("Random-effects model for all studies: Q = ",
              .(formatC(q1$QE, digits=2, format="f")), 
              ", df = ", .(q1$k - q1$p),", p = ", 
              .(formatC(q1$QEp, digits=2, format="f")),
              ", ", I^2, " = ",
              .(formatC(q1$I2, digits=1, format="f")), 
              "%", ", ", tau^2 == 
                .(formatC(q1$tau2, digits=2, format="f")))))

Thank you in advance! 先感谢您!

To make your forest plot without the "RE Model" text in the bottom left hand corner, just use the mlab = "" argument in your forest function call. 要使森林图的左下角没有“ RE Model”文本,只需在forest函数调用中使用mlab = ""参数即可。

forest(res, xlim=c(-39,24), at=c(-12,-9,-6,-3,0,3,6,9,12), showweights = TRUE,
       ilab=cbind(dat$m1i, dat$n1i, dat$sd1i, dat$m2i, dat$n2i, dat$sd2i),
       ilab.xpos=c(-26,-24,-22,-18,-16,-14), cex=1, ylim=c(-2, 10), 
       font=1, digits=2, col="darkgrey", mlab = "")

在此处输入图片说明

Unfortunately I can't run the "Add own text" section of your provided code as you do not provide your q1 object. 不幸的是,由于您没有提供q1对象,因此我无法运行您提供的代码的“添加自己的文本”部分。 But you should be able to solve that yourself. 但是您应该能够自己解决。

I figured this out using the Metafor-Project site, specifically their page on forest plots . 我是通过Metafor-Project网站(特别是他们在林地上的页面)找到答案的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM