[R-meta] [metafor package] How to use italics on one section of a forest plot

Viechtbauer, Wolfgang (SP) wolfg@ng@viechtb@uer @ending from m@@@trichtuniver@ity@nl
Mon Jun 25 10:38:11 CEST 2018


Dear Alexandre,

How about something like this:

dat <- escalc(measure="RR", ai=tpos, bi=tneg, ci=cpos, di=cneg, data=dat.bcg)
res <- rma(yi, vi, data=dat)
forest(res, slab=NA)
text(par()$usr[1], 13:1, dat$author, pos=4, font=3)

Best,
Wolfgang

-----Original Message-----
From: R-sig-meta-analysis [mailto:r-sig-meta-analysis-bounces using r-project.org] On Behalf Of Alexandre Palaoro
Sent: Tuesday, 12 June, 2018 19:39
To: r-sig-meta-analysis using r-project.org
Subject: [R-meta] [metafor package] How to use italics on one section of a forest plot

Dear All,
I want to make a forest plot with subgroups using the forest() function of the
'metafor' package.
My code and potential plot is much similar to the one provided in the metafor
doku page
(http://www.metafor-project.org/doku.php/plots:forest_plot_with_subgroups), but
with one simple difference:
The "Author(s) and Year" column (figure below) is going to be replaced by a list
of species names, and instead of a plain font, I want all species names to be in
italics. In my code, I plotted the species names using the 'slab' argument, as
the code below shows.
forest(res.rma.mv,xlim=c(-10,9),ylim=c(3,108), ilab=ilab.text, 
ilab.xpos=c(-6,-4.5,-3),       slab=expression(italic(data$species.name)),
       pch=21,bg=alpha("black",0.75),efac=0.2,cex=1)
I tried using the expression(italic()) function (and all its variants), but I
always get the same error, regardless of which argument I use ('slab' or
'ilab').
Error in forest.rma(res.rma.mv, xlim = c(-10, 9), ylim = c(3,108), ilab =
expression(italic(random$sp)), : Number of outcomes does not correspond to the
length of the 'ilab' argument. In addition: Warning message: In is.na(ilab) : 
is.na() applied to non-(list or vector) of type 'expression'
Does any one know how to work around this?
Best wishes,Alexandre

--Alexandre Varaschin Palaoro, Dr.LAGE do Departamento de EcologiaUniversidade
de São Paulo, Brazilhttp://alexandrevpalaoro.eco.br
Blog Sobrevivendo na Ciênciahttps://marcoarmello.wordpress.com/


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