I would like to add a polygon to a forest plot with the following label:
"I2 = 92.2%"
wherein the "2" is superscripted and "92.2%" is recalled from an rma object (i.e. res$I2
).
Here is a made-up example:
library(metafor)
data(dat.bcg)
res <- rma(ai=tpos, bi=tneg, ci=cpos, di=cneg, data=dat.bcg, measure="RR",
method="REML")
forest(res)
addpoly(res,mlab=*)
What should *
be?
The below does not superscript "2":
paste("I2 = ",round(res$I2,1),"%"))
The below does not work at all.
bquote(I^2==.(round(res$I2,1))*"%")
You have to turn the result from bquote()
into an expression:
addpoly(res, mlab=as.expression(bquote(I^2==.(round(res$I2,1))*"%")))