Question: Forest plot construction in R software

0

tesfadej2003 •

**10**wrote:I am constructing a forest plot using 'rmeta' package in R.

** code**;

```
model.FE4 <- meta.MH(totemploy, totunemploy, employbfed, unemploybfed, names=Studies,
data= employmentcomplete)
tabletext<-cbind(c("","Studies", model.FE4$names,NA,"Summary"),
c("Breastfeed","(G.Employed)", employmentcomplete$employbfed, NA, NA),
c("Breastfeed","(NG.Employed)", employmentcomplete$unemploybfed, NA, NA),
c("","OR", format(exp(model.FE4$logOR),digits=2),NA,
format(exp(model.FE4$logMH),digits=2)),
c( NA,NA,format(exp(model.FE4$logOR-model.FE4$selogOR*2),digits=2), NA,
format(exp(model.FE4$logMH-model.FE4$selogMH*2), digits=2 )),
c("95% CI", NA, format(exp(model.FE4$logOR+model.FE4$selogOR*2), digits=2), NA,
format(exp(model.FE4$logMH+model.FE4$selogMH*2), digits=2)))
m<- c(NA,NA,model.FE4$logOR,NA,model.FE4$logMH)
l<- m-c(NA,NA,model.FE4$selogOR,NA,model.FE4$selogMH)*2
u<- m+c(NA,NA,model.FE4$selogOR,NA,model.FE4$selogMH)*2
forestplot(tabletext, m, l, u, zero=0,is.summary=c(TRUE,TRUE, rep(FALSE, 6),TRUE), colgap=unit(12,"mm"),
clip=c(log(0.05),log(3.5)), xlog = TRUE, boxsize = 0.5, xlab = "Non-exclusive Exclusive",
col=meta.colors(box="black",line="black", summary="blue"))
```

this is the output Rplot

I want to do 5 things.

- Avoid overlapping of the second and third columns.
- Adding test for heterogeneity values (Tau2, I2, X2, df, p-value) and test for overall effect (Z-value, p-value).
- Adding fixed- and random-effects model estimate.
- Adding the total number of events (column 2 and 3 separately).
- Adding a horizontal line for the column heading.

Thank you very much.

ADD COMMENT
• link
•
modified 2.8 years ago
by
genomax ♦

**87k**• written 2.8 years ago by tesfadej2003 •**10**
Hi, can you please give a link to the exact plot you need (I see the google images results page, with several plots). Which columns are you speaking about? Can you edit your post and add your code to it?

600Thank you very much. Now, I have edited my question and make it more explanatory.

10could you post example data here?

13kThank you very much.

The example data and forest plot which I want to optimize it found on the link below.

https://www.r-bloggers.com/r-and-meta-analysis/

10I think that this will have to be done manually using things like

`mtext()`

,`gridArrange()`

,mfrow(in`par()`

),`abline()`

, etc.Just work through your wish list one by one and you'll get there. There are many plotting functions in R that can help you to produce what you want.

63k