[R-meta] Funnel plot from data frame

Viechtbauer Wolfgang (SP) wolfgang.viechtbauer at maastrichtuniversity.nl
Fri Nov 17 19:50:02 CET 2017


Hi Frank,

Generally, 'base graphics' don't work like that.

You could consider using:

recordPlot()
replayPlot()

See help(recordPlot) for details. See also:

https://stackoverflow.com/questions/29583849/r-saving-a-plot-in-an-object

See also:

https://www.andrewheiss.com/blog/2016/12/08/save-base-graphics-as-pseudo-objects-in-r/

for some other solutions.

Best,
Wolfgang

>-----Original Message-----
>From: R-sig-meta-analysis [mailto:r-sig-meta-analysis-bounces at r-
>project.org] On Behalf Of meta at frankbosco.com
>Sent: Friday, 17 November, 2017 18:53
>To: r-sig-meta-analysis at r-project.org
>Subject: [R-meta] Funnel plot from data frame
>
>Greetings to all,
>
>I am building an R Shiny application that will display several funnel
>plots
>made in metafor. The plots are created within a large, custom function
>and
>all are saved in an R list. However, when I try to reproduce any of the
>plots, a data.frame is returned (and not the plot).
>
>In R, imagine the following two plots saved into a list:
>
>#############################################
>
>#Initialize list
>
>   plotList <- list()
>
>#Save 1st plot as list element 1
>
>   plotList[1] <- funnel(data1, main = "Funnel for data1")
>
>#Save 2nd plot as list element 2
>
>  plotList[2] <- funnel(data2, main = "Funnel for data2")
>
>#############################################
>
>When I run plotList[1], I don't get the plot. I get a data.frame on which
>the plot relies.
>
>My question: Is there any way to return the plot itself or reproduce the
>plot based on the saved data.frame (without saving the plot as an image
>file)?
>
>Thanks,
>Frank
>
>Frank Bosco, Ph.D.
>Associate Professor
>School of Business
>Department of Management
>Virginia Commonwealth University
>Snead Hall
>301 West Main Street, Room B4151
>Richmond, Virginia 23284
>804 828-3197 . Fax: 804 828-1602
>business.vcu.edu



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