An HTML attachment was scrubbed... URL: <https://stat.ethz.ch/pipermail/r-sig-meta-analysis/attachments/20201216/20cfb66f/attachment.html>
[R-meta] Superscript in Forest plot (meta)
6 messages · Guido Schwarzer, Tobias Saueressig
An HTML attachment was scrubbed... URL: <https://stat.ethz.ch/pipermail/r-sig-meta-analysis/attachments/20201217/a00309c4/attachment.html>
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
An HTML attachment was scrubbed... URL: <https://stat.ethz.ch/pipermail/r-sig-meta-analysis/attachments/20201217/95a4509c/attachment.html>
Am 17.12.20 um 17:02 schrieb Tobias Saueressig:
Dear Guido, that looks fantastic. This makes it even better! Thank you. For all people that publish in the JAMA Network that is very helpful.
The following auxiliary R function could be handy in that case:
JAMAlabels <- function(author, year, reference) {
? res <- NA
? for (i in seq(along = author))
??? res[i] <-
????? as.expression(substitute(study^ref~(year),
?????????????????????????????? list(study = author[i],
??????????????????????????????????? ref = reference[i],
??????????????????????????????????? year = year[i])))
? ##
? res
}
refs <- 20 + seq_len(nrow(Fleiss1993bin))
##
mylabs <-
? JAMAlabels(Fleiss1993bin$study, Fleiss1993bin$year, refs)
I will probably add this function to R package meta with the next update.
BW Guido
An HTML attachment was scrubbed... URL: <https://stat.ethz.ch/pipermail/r-sig-meta-analysis/attachments/20201217/705315f4/attachment.html>