[R-meta] Add a reference/citation number to author name in forest plot
Dylan Johnson
dy|@nr@john@on @end|ng |rom m@||@utoronto@c@
Tue Feb 9 16:01:19 CET 2021
Thanks Wolfgang, I will give the latter a try as I have many effects per forest plot.
Best,
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
From: Viechtbauer, Wolfgang (SP)<mailto:wolfgang.viechtbauer using maastrichtuniversity.nl>
Sent: February 8, 2021 5:36 PM
To: Dylan Johnson<mailto:dylanr.johnson using mail.utoronto.ca>; r-sig-meta-analysis using r-project.org<mailto:r-sig-meta-analysis using r-project.org>
Subject: RE: Add a reference/citation number to author name in forest plot
EXTERNAL EMAIL:
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
[[alternative HTML version deleted]]
More information about the R-sig-meta-analysis
mailing list