[R-meta] modifying the default forest plot

Guido Schwarzer sc at imbi.uni-freiburg.de
Tue Dec 5 10:56:41 CET 2017


Am 05.12.17 um 09:58 schrieb Gerta Ruecker:

> Hi,
>
> What about using the R package meta that has the most flexible forest
> function? You can specify all sorts of things, such as ordering, labels,
> title, x-axis label, marker type, fonts, colours, whether the weights
> should be plotted, and so on. See
> https://cran.r-project.org/web/packages/meta/index.html .

Just to give some examples. The forest plots in the attached PDF-file 
were generated using the following R commands:

library(meta)

set.seed(666)
##
mean <- 1:5
se.mean <- mean / 10
author <- sample(LETTERS, 5)
year <- 2005 + sample(-10:10, 5)

m1 <- metagen(mean, se.mean, sm = "MD",
               studlab = paste(author, year))


pdf("forest18.pdf", width = 9.75, height = 4)
##
forest(m1)
forest(m1, sortvar = -TE)
forest(m1, sortvar = year)
forest(m1, xlab = "Estimated Effect Size")
forest(m1, test.overall = TRUE, colgap.forest.left = "2cm")
forest(m1, layout = "JAMA")
forest(m1, layout = "RevMan5")
##
dev.off()


You can use the arguments 'leftcols' and 'rightcols' to add / remove 
columns from the left and right side of the forest plot.

Best wishes,
Guido

-- 
Dr. Guido Schwarzer (sc at imbi.uni-freiburg.de)
Institute of Medical Biometry and Statistics
Stefan-Meier-Str. 26, D-79104 Freiburg | Phone: +49 (0)761 203 6668
http://www.imbi.uni-freiburg.de        | Fax:   +49 (0)761 203 6680

-------------- next part --------------
A non-text attachment was scrubbed...
Name: forest18.pdf
Type: application/pdf
Size: 14973 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-meta-analysis/attachments/20171205/143d33ae/attachment-0001.pdf>


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