Skip to content
Back to formatted view

Raw Message

Message-ID: <8c58bd52-ea5d-8fcb-a560-d1240a26d5a8@imbi.uni-freiburg.de>
Date: 2020-12-17T15:01:47Z
From: Guido Schwarzer
Subject: [R-meta] Superscript in Forest plot (meta)
In-Reply-To: <trinity-3c8184ca-ef1c-4d4c-9c66-5633f5674fdf-1608191676258@3c-app-gmx-bap09>

Tobias,

Good to hear that you found a solution.

I somewhat extended your R code to make it more general.

library(meta)
data(Fleiss1993bin)

refs <- 20 + seq_len(nrow(Fleiss1993bin))
mylabs <- NA
##
for (i in seq_len(nrow(Fleiss1993bin)))
 ? mylabs[i] <-
 ??? as.expression(substitute(study^ref~(year),
 ???????????????????????????? list(study = Fleiss1993bin$study[i],
 ????????????????????????????????? ref = refs[i],
 ????????????????????????????????? year = Fleiss1993bin$year[i])))
##
mylabs

m <- metabin(d.asp, n.asp, d.plac, n.plac, data = Fleiss1993bin,
 ???????????? studlab = paste(study, year),
 ???????????? sm = "OR", comb.random = FALSE)

pdf("forest-study-ref-year.pdf", width = 8.5, height = 3.5)
forest(m, studlab = mylabs)
dev.off()

Best wishes, Guido