Viechtbauer Wolfgang (STAT) Wolfgang.Viechtbauer at STAT.unimaas.nl
Tue Mar 2 19:55:08 CET 2010

```Hi Sebastian,

Here is an example showing a forest plot with some column headings:

########################################################################

library(metafor)

data(dat.bcg)
dat <- dat.bcg

res <- rma(ai=tpos, bi=tneg, ci=cpos, di=cneg, data=dat, measure="RR")

windows(width=6.5, height=4.0, pointsize=10)
par(mar=c(4,0,4,0))
forest(res, slab=paste(dat\$author, ", ", dat\$year, sep=""),
xlim=c(-16,6), at=log(c(.05,.25,1,4)), atransf=exp,
ilab=cbind(dat\$tpos, dat\$tneg, dat\$cpos, dat\$cneg),
ilab.xpos=c(-9.5,-8,-6,-4.5), cex=.8, ylim=c(-1.5,16), efac=1.8)
text(c(-9.5,-8,-6,-4.5), 14.7, c("TB+", "TB-", "TB+", "TB-"),   font=2, cex=.8)
text(c(-8.75,-5.25),     15.7, c("Vaccinated", "Control"),      font=2, cex=.8)
text(-16,                14.7, "Author(s) and Year",     pos=4, font=2, cex=.8)
text(6,                  14.7, "Relative Risk [95% CI]", pos=2, font=2, cex=.8)
title("Figure 1: Forest Plot of the BCG Vaccine Data")

########################################################################

So, just use the text() function to add those column headings. With the ilab and ilab.xpos arguments, you can add the information for those columns to the plot.

I hope the example helps!

Best,

--
Wolfgang Viechtbauer                        http://www.wvbauer.com/
Department of Methodology and Statistics    Tel: +31 (0)43 388-2277
School for Public Health and Primary Care   Office Location:
Maastricht University, P.O. Box 616         Room B2.01 (second floor)
6200 MD Maastricht, The Netherlands         Debyeplein 1 (Randwyck)

----Original Message----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
Behalf Of Sebastian Stegmann Sent: Tuesday, March 02, 2010 18:36
To: r-help at r-project.org

> Dear R-community,
>
> I'm currently trying to assemble a forest plot using the "forest"
> function from package "metaphor".
>
> Works well. Even the regular "main"-argument works for adding a title to
> the graph.
>
> However, I would like to add one top row which explains the nature of the
>
> For example: "Study"   "Sample"   "Sample Size"   "Estimated Effect Size"
> "CI 95%".
>
> I tried to add "axis(3)", but apparently the forest plot isn't that kind
> of graphic.
>
> Does anyone have any idea?
>
> Cheerio
>
> Sebastian
>
>
>       [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help