guido-s / meta

Official Git repository of R package meta
http://cran.r-project.org/web/packages/meta/index.html
GNU General Public License v2.0
82 stars 32 forks source link

title, complab, outclab, byseparator don't work in metaprop #2

Closed mankowitz closed 7 years ago

mankowitz commented 7 years ago

In the following code,

library(meta)
studies <- c("Cong 2015","Parsch 2017","Gangathimmaiah 2017","Isbister 2016","Kowalski 2015","Riddell 2017","Scaggs 2016","Schepke 2015","Olives 2016","Cole 2016","Burnett 2015","Keseg 2014","Hollis 2017","Burnett 2012")        
obs <- c(0,0,3,0,0,2,0,2,85,25,14,8,10,2)
denom <- c(18,22,21,49,5,23,7,52,135,64,49,35,38,12)
grouping <- c("AMT","AMT","AMT","ED","ED","ED","EMS","EMS","EMS","EMS","EMS","EMS","EMS","EMS")
m1 <- metaprop(obs, denom, studies, comb.random=FALSE,
complab="N", outclab="intubated", title="Intubation rates",
byvar=grouping, bylab="Setting", byseparator=":")                                    
forest(m1)

The complab, coutclab, byseparator and title do not appear.

guido-s commented 7 years ago

Thank you for the hint.

I changed the default for argument 'byseparator' in forest.meta() in the GitHub version of R package meta. Now, the value for this argument defined in meta-analysis functions - like metaprop() - is recognized by forest.meta().

The other arguments are only used at the moment in the printing of meta-analysis objects. See, e.g., output of R command summary(m1) .

You can use grid.text to add a title to a forest plot. E.g.,

pdf("forest-with-title.pdf", width = 9.5, height = 8)
##
forest(m1, calcwidth.hetstat = TRUE)
grid::grid.text("Intubation rates", 0.5, 0.96, gp = grid::gpar(cex = 2))
grid::grid.text("intubated", 0.5, 0.92, gp = grid::gpar(cex = 1.5))
##
dev.off()
mankowitz commented 6 years ago

thanks! The code snippet works well for the title, which is superimposed on top of the plot.

To change the column headings in the forest plot, I had to add leftlabs=c("Study","Intubated","Total")