3

I am trying to create a forest plot in R using the forest() function from the metafor package. I refer to the documentation on R's website for all of the arguments that I can add to this function.

Currently this is my code:

forest(dat.back$yi, ci.lb=dat.back$ci.lb, ci.ub=dat.back$ci.ub, psize=1, studlab=labels)

I have defined labels previously (basically just a list of the study names I am included in the forest plot).

According to the documentation for this function, studlab is a valid argument. However I get the following error message when I add it to the function:

"studlab" is not a graphical parameter.

This is not the only argument that produces an error message for. It does it for most other arguments I add.

How do I address this error?

user20650
  • 24,654
  • 5
  • 56
  • 91
aspire94
  • 131
  • 1
  • 3
  • https://wviechtb.github.io/metafor/reference/forest.rma.html doesn't seem to indicate a `studlab` argument. Where did you see it? – user20650 Aug 14 '20 at 18:33
  • @user20650 Here: https://www.rdocumentation.org/packages/meta/versions/1.1-2/topics/forest#:~:text=A%20forest%20plot%2C%20also%20called,on%20the%20grid%20graphics%20system. – aspire94 Aug 14 '20 at 18:38
  • ..,. perhaps you are looking at old documentation . Edit.. rdocumentation is often out of data, as can online tutorials etc. Your best bet is to look at the function help page `?metafor::forest` – user20650 Aug 14 '20 at 18:38
  • @user20650 I managed to somehow get studlab to work a few days ago, though. I have just deleted that code so can't see what I did differently. However, the header argument also gives the same error (and that argument was listed in the resource your linked to) – aspire94 Aug 14 '20 at 18:40
  • have you upgraded R or reinstalled the package. The rdocumentation links to metafor v1.1.2 but the version on cran is 2.4-0 (ps this is a better link to the default forest help: https://wviechtb.github.io/metafor/reference/forest.default.html) – user20650 Aug 14 '20 at 18:41
  • I usually try to keep it up to date, so that could possibly be the issue? Or maybe the first object used in my function is of a different class then what that documentation is for? – aspire94 Aug 14 '20 at 18:44
  • What does `packageVersion("metafor")` return? – user20650 Aug 14 '20 at 18:45
  • It returns 2.1.0 – aspire94 Aug 14 '20 at 18:50
  • okay thanks. Just checked, `forest.default` version 2.1.0 does not have a `studlab` argument – user20650 Aug 14 '20 at 18:53
  • I just updated it to 2.4.0. Using ?metafor::forest to get help, I tried adding in some of the arguments from that to the function. However, I still get the same error for most arguments I use. – aspire94 Aug 14 '20 at 18:53
  • Are you getting warning for any of `ci.lb, ci.ub, psize` ? Do you still get a plot (i.e. as these are likely warnings rather than errors) – user20650 Aug 14 '20 at 18:56
  • They work and I don't get a warning. It does create a plot, however the plot looks VERY weird. The scaling is completely wrong, the studies aren't labeled (just says "study 1", "study 2", etc as I am unable to add labels right now), the overall effect size isn't included (although I think I know how to add that), and the columns aren't labeled. I suppose that may all be expected if I haven't attempted to scale the plot yet, though. – aspire94 Aug 14 '20 at 19:00
  • okay. That makes it a bit difficult to offer advice if the arguments shown in your question work okay (except studlab). Only advice is to make sure that you are using the correct names by reviewing the help pages and the current online documentation. For more help will need at reproducible example. – user20650 Aug 14 '20 at 19:03
  • The `forest()` function of the **metafor** package does not have a `studlab` argument. You are mixing up the **meta** and the **metafor** packages. – Wolfgang Aug 15 '20 at 13:39

0 Answers0