[R] Error message in meta-analysis package Metafor-weights =""

Viechtbauer, Wolfgang (SP) wo||g@ng@v|echtb@uer @end|ng |rom m@@@tr|chtun|ver@|ty@n|
Tue Jun 23 09:24:22 CEST 2020


Dear Kobby,

Please post the output of sessionInfo() and class(result.md).

Best,
Wolfgang

>-----Original Message-----
>From: K Amoatwi [mailto:amoatwik20 using gmail.com]
>Sent: Monday, 22 June, 2020 22:30
>To: Viechtbauer, Wolfgang (SP)
>Cc: r-help using 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.viechtbauer using 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-bounces using r-project.org] On Behalf Of K Amoatwi
>>Sent: Tuesday, 16 June, 2020 4:50
>>To: r-help using 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


More information about the R-help mailing list