[R-meta] Add a reference/citation number to author name in forest plot

Viechtbauer, Wolfgang (SP) wo||g@ng@v|echtb@uer @end|ng |rom m@@@tr|chtun|ver@|ty@n|
Mon Feb 8 23:36:39 CET 2021


Hi Dylan,

Depends to what extent you want to do this 'manually'. Here is an example:

library(metafor)
dat <- dat.bcg

labs <- paste(dat$author, dat$year)
labs[1] <- expression(paste("Aronson,", plain()^1, " 1948"))

res <- rma(ai=tpos, bi=tneg, ci=cpos, di=cneg, data=dat, measure="RR", method="REML")
forest(res, slab = labs)

So here I am 'hardcoding' the author, reference number, and year number for the first study and the same could be done for the others. If you don't have a lot of studies, then this could be done by hand.

If you want to do this 'programmatically', it gets a bit more tricky, because you have to substitute values, plus generate an expression that can be used for 'math plotting'. A bit of a nightmarish solution would be:

labs <- mapply(function(x,y,z) as.expression(bquote(.(x)^.(y)*","~.(z))), dat$author, dat$trial, dat$year)
forest(res, slab = labs)

Best,
Wolfgang

>-----Original Message-----
>From: Dylan Johnson [mailto:dylanr.johnson using mail.utoronto.ca]
>Sent: Monday, 08 February, 2021 23:02
>To: r-sig-meta-analysis using r-project.org
>Cc: Viechtbauer, Wolfgang (SP)
>Subject: Add a reference/citation number to author name in forest plot
>
>Hello,
>
>The journal that I am submitting to has requested that I add AMA format reference
>numbers for each article in the forest plot, in the format:
>
>Johnson et al.,1 2020
>
>Does anyone have advice for how I can go about this with the forest.rma function?
>
>Thanks!
>
>Dylan
>
>Dylan Johnson, MSc
>MA Student, School and Clinical Child Psychology
>Department of Applied Psychology and Human Development
>University of Toronto
>252 Bloor Street West
>Toronto, ON M5S 1V6


More information about the R-sig-meta-analysis mailing list