You have loaded the 'meta' package after 'metafor' and then forest() will try to use the corresponding function from the meta package and not metafor. With:
metafor::forest(result.md) it should work. Best, Wolfgang >-----Original Message----- >From: K Amoatwi [mailto:amoatwi...@gmail.com] >Sent: Tuesday, 23 June, 2020 16:37 >To: Viechtbauer, Wolfgang (SP) >Cc: r-help@r-project.org >Subject: Re: [R] Error message in meta-analysis package Metafor-weights ="" > >Dear Wolfgang, >I have posted the requested information you asked for. > >> sessionInfo() >R version 4.0.1 (2020-06-06) >Platform: x86_64-w64-mingw32/x64 (64-bit) >Running under: Windows 10 x64 (build 18362) > >Matrix products: default > >locale: >[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United >States.1252 >[3] LC_MONETARY=English_United States.1252 >LC_NUMERIC=C >[5] LC_TIME=English_United States.1252 > >attached base packages: >[1] stats graphics grDevices utils datasets methods base > >other attached packages: >[1] meta_4.12-0 reshape2_1.4.4 metafor_2.4-0 Matrix_1.2-18 > >loaded via a namespace (and not attached): > [1] Rcpp_1.0.4.6 lattice_0.20-41 MASS_7.3- >51.6 grid_4.0.1 > [5] plyr_1.8.6 nlme_3.1- >148 magrittr_1.5 stringi_1.4.6 > [9] minqa_1.2.4 nloptr_1.2.2.1 boot_1.3- >25 splines_4.0.1 >[13] statmod_1.4.34 lme4_1.1- >23 tools_4.0.1 stringr_1.4.0 >[17] CompQuadForm_1.4.3 compiler_4.0.1 >> > >> class(result.md) >[1] "rma.uni" "rma" >> > >Thank you >Kobby > >On Tue, Jun 23, 2020 at 3:24 AM Viechtbauer, Wolfgang (SP) ><wolfgang.viechtba...@maastrichtuniversity.nl> wrote: >Dear Kobby, > >Please post the output of sessionInfo() and class(result.md). > >Best, >Wolfgang > >>-----Original Message----- >>From: K Amoatwi [mailto:amoatwi...@gmail.com] >>Sent: Monday, 22 June, 2020 22:30 >>To: Viechtbauer, Wolfgang (SP) >>Cc: r-help@r-project.org >>Subject: Re: [R] Error message in meta-analysis package Metafor-weights ="" >> >>Hi Wolfgang and All, >>I am still practising my meta-analysis with the "Metafor" package, I tried >>to run the code for "Forest plot" and got error message as shown below: >>forest(result.md) >>> forest(result.md) >>Error in UseMethod("forest") : >> no applicable method for 'forest' applied to an object of class >>"c('rma.uni', 'rma')" >> >>Thank you in advance for your support >> >>regards >>Kobby >> >>On Tue, Jun 16, 2020 at 12:50 PM Viechtbauer, Wolfgang (SP) >><wolfgang.viechtba...@maastrichtuniversity.nl> wrote: >>Dear Amoatwi, >> >>This way of using the escalc() function has been deprecated. It might be >>added back once there is actually any benefit from having this >>functionality, but for years it just meant that I had to maintain two >>different ways of doing the exact same thing without any additional >>benefits. >> >>Best, >>Wolfgang >> >>-- >>Wolfgang Viechtbauer, Ph.D., Statistician | Department of Psychiatry and >>Neuropsychology | Maastricht University | P.O. Box 616 (VIJV1) | 6200 MD >>Maastricht, The Netherlands | +31 (43) 388-4170 | http://www.wvbauer.com >> >>>-----Original Message----- >>>From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of K Amoatwi >>>Sent: Tuesday, 16 June, 2020 4:50 >>>To: r-help@r-project.org >>>Subject: [R] Error message in meta-analysis package Metafor-weights ="" >>> >>>Dear All, >>>I am using the example from one of the tutorial about "Metafor" package >and >>>"escalc" function, to learn how this package can be applied to do >>>meta-analysi; the code and the data is directly from the tutorials but >>>"weights=freq" option in the escalc function is given me error message >>>This is the code below: >>> >>>library(metafor) # Load package >>>#####DATASET 1: BCG Vaccine Trials >>>data(dat.bcg) # BCG meta-analytic dataset >>> >>>##Formula based Specification >>>##That is, what if I have multiple rows per study, corresponding to >>>difference treatment groups? >>> >>>library(reshape2) # Load package for data reshaping >>> >>>bcg.long <- melt(dat.bcg[, c("trial", "tpos", "tneg", "cpos", "cneg")], id >>>= "trial") >>>bcg.long$pos <- ifelse(bcg.long$var == "tpos" | bcg.long$var == "cpos", 1, >>>0) >>>bcg.long$group <- ifelse(bcg.long$var == "tpos" | bcg.long$var == "tneg", >>>1, 0) >>> >>>##sample of the data, the first 6 rows >>>head(bcg.long) >>> trial variable value pos group >>>1 1 tpos 4 1 1 >>>2 2 tpos 6 1 1 >>>3 3 tpos 3 1 1 >>>4 4 tpos 62 1 1 >>>5 5 tpos 33 1 1 >>>6 6 tpos 180 1 1 >>> >>>##Now applying the " escalc " function >>> >>>escalc(factor(pos)~factor(group)| factor(trial),weights = value,data = >>>bcg.long, measure = "OR") >>> >>>##Then I got this error message >>>Error in escalc(factor(pos) ~ factor(group) | factor(trial), weights = >>>value, : >>> object 'value' not found >>> >>>I used the same data with different example from another author and got a >>>similar error message >>>Second code with the same data but different coding >>>Sample data >>> >>>with the first 6 rows of the rearranged data shown below. (T=treatment, >>>C=Control group, Out=outcome whether positive or negative, and then >>>frequency) >>> study grp out freq >>>1 1 T + 4 >>>2 1 T - 119 >>>3 1 C + 11 >>>4 1 C - 128 >>>5 2 T + 6 >>>6 2 T - 300 >>> >>>>escalc(out ~ grp | study, weights = freq, data = dat.fm, measure = "OR") >>> >>>Error in escalc(out ~ grp | study, weights = freq, data = dat.fm, measure >= >>>"OR") : >>> object 'freq' not found >>> >>>I am not sure what I am doing wrong since both authors were able to get >>>their results while I am getting error messages. >>> >>>Any help will be very much appreciated >>> >>>Amoatwi ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.