I am trying to add "Odds ratio" label above the forest plot and "flavor control" and "flavor intervention" below my forest plot but couldnt find a way to do so.
below is my code
data("CrinsEtAl2014")
library(bayesmeta)
library(forestplot)
library(metafor)
crins.es <- escalc(measure="OR",
ai=exp.AR.events, n1i=exp.total,
ci=cont.AR.events, n2i=cont.total,
slab=publication, data=CrinsEtAl2014)
print(crins.es)
# perform meta analysis:
crins.ma <- bayesmeta(crins.es, tau.prior=function(t){dhalfcauchy(t,scale=1)})
########################
# generate forest plots
fp <- forestplot(crins.ma, expo=TRUE, plot=FALSE)
labtext <- fp$labeltext
labtext <- cbind(labtext[,1],
c("treatment",
paste0(CrinsEtAl2014[,"exp.AR.events"], "/", CrinsEtAl2014[,"exp.total"]),
"",""),
c("control",
paste0(CrinsEtAl2014[,"cont.AR.events"], "/", CrinsEtAl2014[,"cont.total"]),
"",""),
labtext[,2:3])
labtext[1,4] <- "OR"
print(fp$labeltext) # before
print(labtext) # after
forestplot(crins.ma, clip=c(-4,1), xticks=(-3):0,
xlab="log-OR", title="pediatric transplantation example",
txt_gp = fpTxtGp(ticks = gpar(cex=1), xlab = gpar(cex=1)))
want to add OR above the plot and flavor intervention and control below the plot