[R-meta] labels on forest plots
li@t@ @ending from dewey@myzen@co@uk
Fri Aug 31 18:05:36 CEST 2018
On 31/08/2018 14:52, Antonia Sudkaemper wrote:
> Hello metafor community,
> I have one last question on forest plots - I am trying to add labels to the
> forest plot ("Study", "Weights", "Cohen's d [95%]"). From the metafor
> instruction I understand I do this via the ilab, ilab.xpos functions.
> Adding the commands
> ilab.xpos = c(-5, -3, -1), ilab = c("Study", "Weight", "Cohen's d [95%]")
And gives an error. You only meant to give a single value for ilab.xpos
I think. But also see further below.
> to the forest command does not work though. Does anyone know what my
> mistake is?
> See code below. All the best, and thank you so much. Antonia
> yi = c(0.2083, 0.2348, 0.3879) #Cohens's d
> vi = c(0.0101, 0.0124, 0.0126) #variance
> study<-c("Study 1", "Study 2", "Study 3")
> summary(meta <- rma(yi=yi, vi=vi, method= "FE", slab=c("Study 1", "Study
> 2", "Study 3")))
You could have saved space with slab = study
> forest(meta, xlab = "Cohen's d", showweights = TRUE)
The problem is that you told forest to plot the added text off the plot.
You need to do two things. (1) make extra width by xlim = c(-5, 15) or
something similar. (2) give a value for ilab.xpos which is within range
(like 5 if you use xlim = c(-5, 15)). This should show all the text and
now you need to fiddle with the values to get it all exactly where you
want it and everything in a readable size.
More information about the R-sig-meta-analysis