Sure. Here is an example: library(metafor) data(dat.bcg) windows(height=8, width=6, pointsize=10) par(mfrow=c(2,1)) dat <- escalc(measure="RR", ai=tpos, bi=tneg, ci=cpos, di=cneg, data=dat.bcg) res <- rma(yi, vi, data=dat) forest(res, atransf=exp) title("Forest Plot of Relative Risks") dat <- escalc(measure="OR", ai=tpos, bi=tneg, ci=cpos, di=cneg, data=dat.bcg) res <- rma(yi, vi, data=dat) forest(res, atransf=exp) title("Forest Plot of Odds Ratios")
Best, -- Wolfgang Viechtbauer Department of Psychiatry and Neuropsychology School for Mental Health and Neuroscience Maastricht University, P.O. Box 616 6200 MD Maastricht, The Netherlands Tel: +31 (43) 368-5248 Fax: +31 (43) 368-8689 Web: http://www.wvbauer.com > -----Original Message----- > From: Samor Gandhi [mailto:samorgan...@yahoo.com] > Sent: Tuesday, April 12, 2011 15:59 > To: r-h...@stat.math.ethz.ch; Viechtbauer Wolfgang (STAT) > Subject: RE: [R] forest + igraph ? > > Thanks, That is a nice one. Is there any option that I can plot the pooled > estimate? > > Regards, > Samor > > --- On Tue, 12/4/11, Viechtbauer Wolfgang (STAT) > <wolfgang.viechtba...@maastrichtuniversity.nl> wrote: > > From: Viechtbauer Wolfgang (STAT) > <wolfgang.viechtba...@maastrichtuniversity.nl> > Subject: RE: [R] forest + igraph ? > To: "Samor Gandhi" <samorgan...@yahoo.com>, "r-h...@stat.math.ethz.ch" <r- > h...@stat.math.ethz.ch> > Date: Tuesday, 12 April, 2011, 15:54 > You said that you do NOT want to use par(mfrow=c(2,1)). Why not? > > Isn't this (below) what you want? > > library(metafor) > data(dat.bcg) > > windows(height=8, width=6, pointsize=10) > par(mfrow=c(2,1)) > dat <- escalc(measure="RR", ai=tpos, bi=tneg, ci=cpos, di=cneg, > data=dat.bcg) > forest(dat$yi, dat$vi, atransf=exp) > title("Forest Plot of Relative Risks") > dat <- escalc(measure="OR", ai=tpos, bi=tneg, ci=cpos, di=cneg, > data=dat.bcg) > forest(dat$yi, dat$vi, atransf=exp) > title("Forest Plot of Odds Ratios") > > Best, > > -- > Wolfgang Viechtbauer > Department of Psychiatry and Neuropsychology > School for Mental Health and Neuroscience > Maastricht University, P.O. Box 616 > 6200 MD Maastricht, The Netherlands > Tel: +31 (43) 368-5248 > Fax: +31 (43) 368-8689 > Web: http://www.wvbauer.com > > > > -----Original Message----- > > From: Samor Gandhi [mailto:samorgan...@yahoo.com] > > Sent: Tuesday, April 12, 2011 11:52 > > To: r-h...@stat.math.ethz.ch; Viechtbauer Wolfgang (STAT) > > Subject: RE: [R] forest + igraph ? > > > > Thank you for your reply. I would like to have two forest plots one on > top > > and the other on the bottom. I am using R version 2.12.2 (32-bit) > Windows. > > The code you sent me still plotting two windows one after the other? > > > > Best wishes and many thanks, > > Samor > > > > --- On Tue, 12/4/11, Viechtbauer Wolfgang (STAT) > > <wolfgang.viechtba...@maastrichtuniversity.nl> wrote: > > > > From: Viechtbauer Wolfgang (STAT) > > <wolfgang.viechtba...@maastrichtuniversity.nl> > > Subject: RE: [R] forest + igraph ? > > To: "r-h...@stat.math.ethz.ch" <r-h...@stat.math.ethz.ch> > > Cc: "Samor Gandhi" <samorgan...@yahoo.com> > > Date: Tuesday, 12 April, 2011, 13:42 > > It is not clear (at least to me) what exactly you want. You want two > > forest plots "in one graph" but apparently not side-by-side or one on > top > > and the other on the bottom. So, you want to superimpose them? How do > you > > want to do that without creating an illegible mess? Or do you want one > > graph, where you can scroll through various plots? Then try this: > > > > library(metafor) > > data(dat.bcg) > > > > if (interactive()) { > > windows(record=TRUE) > > dat <- escalc(measure="RR", ai=tpos, bi=tneg, ci=cpos, di=cneg, > > data=dat.bcg) > > forest(dat$yi, dat$vi) > > dat <- escalc(measure="OR", ai=tpos, bi=tneg, ci=cpos, di=cneg, > > data=dat.bcg) > > forest(dat$yi, dat$vi) > > } > > > > and then use PageUp and PageDown to switch between the figures. > > > > (I don't know what OS you are using, so windows() may not work). > > > > Best, > > > > -- > > Wolfgang Viechtbauer > > Department of Psychiatry and Neuropsychology > > School for Mental Health and Neuroscience > > Maastricht University, P.O. Box 616 > > 6200 MD Maastricht, The Netherlands > > Tel: +31 (43) 368-5248 > > Fax: +31 (43) 368-8689 > > Web: http://www.wvbauer.com > > > > > -----Original Message----- > > > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] > > > On Behalf Of Samor Gandhi > > > Sent: Monday, April 11, 2011 18:25 > > > To: r-h...@stat.math.ethz.ch > > > Subject: [R] forest + igraph ? > > > > > > Hello, > > > > > > Is it possible to have two meta-plots in one graph (not > > par(mfrow=c(2,1))? > > > But somthing like > > > > > > library(metafor) > > > library("igraph") > > > > > > if (interactive()) { > > > forest(dat.Treat$RR, ci.lb=dat.Treat$lower, ci.ub=dat.Treat$upper, > > > xlab="Relative Risk",slab=dat.Treat$ID,refline=1) > > > forest(dat.Control$RR, ci.lb=dat.Control$lower, > > > ci.ub=dat.Control$upper, xlab="Relative > > > Risk",slab=dat.Control$ID,refline=1) > > > } > > > > > > i.e. both metaplots on the same graph! > > > > > > Regards, > > > Samor ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.