Creating forest plot for meta-analysis

Hi, I am new to R. I am learning to code to perform meta-analysis. I am reading Doing Meta-Analysis in R. I encountered this error. Is anyone able to help with this?

'''

Make sure meta and dmetar are already loaded

library(meta)
library(dmetar)
Extensive documentation for the dmetar package can be found at:
Welcome! | Doing Meta-Analysis in R
library(meta)

Load dataset from dmetar (or download and open manually)

data(SuicidePrevention)

Use metcont to pool results.

m.cont <- metacont(n.e = n.e,

  •                mean.e = mean.e,
    
  •                sd.e = sd.e,
    
  •                n.c = n.c,
    
  •                mean.c = mean.c,
    
  •                sd.c = sd.c,
    
  •                studlab = author,
    
  •                data = SuicidePrevention,
    
  •                sm = "SMD",
    
  •                method.smd = "Hedges",
    
  •                fixed = FALSE,
    
  •                random = TRUE,
    
  •                method.tau = "REML",
    
  •                hakn = TRUE,
    
  •                title = "Suicide Prevention")
    

summary(m.cont)
Review: Suicide Prevention

                SMD             95%-CI %W(random)

Berry et al. -0.1428 [-0.4315; 0.1459] 15.6
DeVries et al. -0.6077 [-0.9402; -0.2752] 12.3
Fleming et al. -0.1112 [-0.6177; 0.3953] 5.7
Hunt & Burke -0.1270 [-0.4725; 0.2185] 11.5
McCarthy et al. -0.3925 [-0.7884; 0.0034] 9.0
Meijer et al. -0.2676 [-0.5331; -0.0021] 17.9
Rivera et al. 0.0124 [-0.3454; 0.3703] 10.8
Watkins et al. -0.2448 [-0.6848; 0.1952] 7.4
Zaytsev et al. -0.1265 [-0.5062; 0.2533] 9.7

Number of studies: k = 9
Number of observations: o = 1147 (o.e = 571, o.c = 576)

                     SMD             95%-CI     t p-value

Random effects model -0.2304 [-0.3734; -0.0874] -3.71 0.0059

Quantifying heterogeneity:
tau^2 = 0.0044 [0.0000; 0.0924]; tau = 0.0661 [0.0000; 0.3040]
I^2 = 7.4% [0.0%; 67.4%]; H = 1.04 [1.00; 1.75]

Test of heterogeneity:
Q d.f. p-value
8.64 8 0.3738

Details on meta-analytical method:

  • Inverse variance method
  • Restricted maximum-likelihood estimator for tau^2
  • Q-Profile method for confidence interval of tau^2 and tau
  • Hartung-Knapp adjustment for random effects model (df = 8)
  • Hedges' g (bias corrected standardised mean difference; using exact formulae)

forest.meta(m.gen,

  •         sortvar = TE,
    
  •         prediction = TRUE, 
    
  •         print.tau2 = FALSE,
    
  •         leftlabs = c("Author", "g", "SE"))
    

Error in forest.meta(m.gen, sortvar = TE, prediction = TRUE, print.tau2 = FALSE, :
could not find function "forest.meta"
'''

Hi @LeoOng
Welcome to the Community Forum.

I think you need to change the plotting command to

forest.meta(m.cont,   …….

to specify your produced meta object. Of course, I can’t test this as I don’t have access to your data.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.