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.

Reply via email to