This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Forest plot construction in R software

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.

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

Thank you very much.

r forstplot rmeta

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?

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

could you post example data here?

I 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.

0 answers

No answers yet.

Log in to answer this question.