Skip to content
Back to formatted view

Raw Message

Message-ID: <fdb728dc-8339-b808-e777-b426fd4aabd3@imbi.uni-freiburg.de>
Date: 2022-01-31T21:09:36Z
From: Guido Schwarzer
Subject: [R-meta] How to use superscript in the forest plot (package 'meta')?
In-Reply-To: <CAPmpGDtz4D8xVa_kbObApZN9qbR=HPxTXy9SboZMJN-RPBFJtA@mail.gmail.com>

Antonello,

R function JAMAlabels() in meta can be used for JAMA labels, i.e., 
Author (Year) superscript index. At the moment there is no corresponding 
function for Lancet labels.

The following R code - adapted from JAMAlabels() - generates and uses 
Lancet labels in the forest plot:

library(meta)
data(Fleiss1993bin)

refs <- 20 + 1:7

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

m <- metabin(d.asp, n.asp, d.plac, n.plac, data = Fleiss1993bin, sm = "OR")

forest(m, studlab = mylabs)

Best,

Guido