[R-meta] Metafor package: Using subset in forest()

Simioni, Julia @imioni @ending from mcm@@ter@c@
Mon Jul 30 18:39:04 CEST 2018


I'm using the Metafor package in R to run a metanalysis and generate a forest plot. I'm wondering if it is possible to use subset as an argument in the forest() function? It is not listed as one in the documentation but through looking online for a solution to my problem, I've seen it mentioned in forums that is possible. I think I may be using it incorrectly though.

I have a csv file that contains data from many studies but I only want to use some of them in my meta analysis and forest plot. I have attached the csv file. When I run rma() using subset it works fine.

png(filename="primary2.png", pointsize=11, res=95, width=900, height=680, type="cairo")
primary <-           rma(yi, vi,
                                data=dat,
                                measure="OR",
                                slab = paste(dat$author, dat$year, sep=", "),
                                subset=(outcome=="periorneomortalityany" & Parity=="nullip" & Integration=="integ"),
                                digits=2, level=95)

but when I try this in forest() I get warnings saying that subset is not a graphical parameter and the plot will not populate. Without the subset argument working correctly in forest() the order argument does not work properly and the ilab argument results in the ai, bi, ci, di from the first studies in my csv file being added to my plot, rather than the ai, bi, ci, di from the studies that I want.

forest(primary,
                addfit=TRUE,
                showweights=TRUE,
                atransf=exp,
                xlab="Odds Ratio",
                mlab="Random Effects Model",
                subset=(dat$outcome=="periorneomortalityany" & dat$Parity=="nullip" & dat$Integration=="integ"),
                order=order(dat$PragIdeal),
                ilab=cbind(dat$HomePos, dat$HomeNeg, dat$HospPos, dat$HospNeg),
                ilab.xpos=c(-14.5,-12,-9,-6)
                )
dev.off()

Any advice is greatly appreciated.





-------------- next part --------------
A non-text attachment was scrubbed...
Name: MyData.csv
Type: application/octet-stream
Size: 59358 bytes
Desc: MyData.csv
URL: <https://stat.ethz.ch/pipermail/r-sig-meta-analysis/attachments/20180730/e790230b/attachment-0001.obj>


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