Forest plot study labeling


#1

Hi everyone,

for my meta-analysis that I am conducting with metafor, I am trying to create a forest plot of my first RMA ("model1").

forest(model1, slab=paste(data$Reference), xlab = "Hedges' g")

This works fine, but still on the left side the studies are labeled "Study1" etc. (till "Study36"). How can I change these labels into the actual names of the studies (author, year)? I have already tried
slab=paste(data$Reference)
but this does not work since the original dataset includes more effect sizes than model1 because there were sometimes several effect sizes per sample, so I pooled them. Thus, in total, there are 46 lines in the original dataset, but only 36 effect sizes that I want to include in the forest plot.
Maybe I can solve the problem labeling the studies manually? How would that work?

Second question: How can I add titles to the columns, such as "Author & Year" and "g [95% CI]"?
Thanks already!


#2

Could you please turn this into a self-contained reprex (short for reproducible example)? It will help us help you if we can be sure we're all working with/looking at the same stuff.

install.packages("reprex")

If you've never heard of a reprex before, you might want to start by reading the tidyverse.org help page. The reprex dos and don'ts are also useful.

What to do if you run into clipboard problems

If you run into problems with access to your clipboard, you can specify an outfile for the reprex, and then copy and paste the contents into the forum.

reprex::reprex(input = "fruits_stringdist.R", outfile = "fruits_stringdist.md")

For pointers specific to the community site, check out the reprex FAQ.