metaSEM example running error

5 replies [Last post]
Ningli's picture
Offline
Joined: 11/10/2013

Dear Mike,

I am attempting to use your R package metaSEM but I came across some problems when I running summary( meta3(y=y, v=v, cluster=District, data=Cooper03) ) in "metaSEM" website. R version that I use is 2.15.3.

Error:
summary( meta3(y=y, v=v, cluster=District, data=Cooper03) )
Running Meta analysis with ML
错误于sort.int(x, na.last = na.last, decreasing = decreasing, ...) :
'x' must be atomic
此外: 警告信息:
In mean.default(x, na.rm = TRUE) :
argument is not numeric or logical: returning NA

meta3(y=y, v=v, cluster=District, data=Cooper03)
Running Meta analysis with ML

Call:
meta3(y = y, v = v, cluster = District, data = Cooper03)

Structure:
Length Class Mode
call 5 -none- call
I2 1 -none- character
R2 1 -none- logical
data.wide 23 data.frame list
data 4 data.frame list
no.y 1 -none- numeric
no.x 1 -none- numeric
miss.x 56 -none- logical
mx.model 1 MxModel S4
mx.fit 1 MxModel S4
mx0.fit 1 -none- logical
intervals.type 1 -none- character

Best regards,
Ning

Ningli's picture
Offline
Joined: 11/10/2013
Dear Mike, When I ran the

Dear Mike,

When I ran the syntax summary( meta3(y=y, v=v, cluster=District, data=Cooper03) ) but it did't work. The following attachment is screenshot of errors.

Best regards,
Ning

metasem.PNG
Mike Cheung's picture
Offline
Joined: 10/08/2009
Dear Ning, It is strange that

Dear Ning,

It is strange that it shows meta and meta3 are masked. It appears that you already have a copy of meta and meta3 in your environment. I do not know what's wrong.

Could you close R and open it again? Then type
sink("bugs.txt")
ls()
library(metaSEM)
mymeta <- meta3(y=y, v=v, cluster=District, data=Cooper03)
summary(mymeta)
sessionInfo()
sink()

Could you send the output (bugs.txt in your directory) to my email (mikewlcheung@nus.edu.sg) instead of to this discussion forum? Since most readers may not be interested in this issue, it is better to do if off-list. I will post a summary regarding this issue when it is resolved.

Mike

Ningli's picture
Offline
Joined: 11/10/2013
Metasem running errors

Dear Mike,

The file attachment is the program, following errors occurred after I ran the program. I did't know why. Could you help me explain it?

summary(meta3)
错误于x[!is.na(x)] : 类别为'closure'的对象不可以取子集
此外: 警告信息:
1: In mean.default(x, na.rm = TRUE) :
argument is not numeric or logical: returning NA
2: In is.na(x) : is.na()不适用于类别为'closure'的非串列或非矢量

sessionInfo()
R version 2.15.3 (2013-03-01)
Platform: i386-w64-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=Chinese (Simplified)_China.936
[2] LC_CTYPE=Chinese (Simplified)_China.936
[3] LC_MONETARY=Chinese (Simplified)_China.936
[4] LC_NUMERIC=C
[5] LC_TIME=Chinese (Simplified)_China.936

attached base packages:
[1] stats graphics grDevices utils datasets methods base

loaded via a namespace (and not attached):
[1] grid_2.15.3 lattice_0.20-13 nlme_3.1-108 tools_2.15.3

Best regards,
Ning

AttachmentSize
myData.R 219 bytes
Mike Cheung's picture
Offline
Joined: 10/08/2009
Hi Ning, The following syntax

Hi Ning,

The following syntax does NOT work.
meta3(y=y, v=v, cluster=District, data=Cooper03)
summary(meta3)

You need to save the output into an object first, e.g.,
my.meta <- meta3(y=y, v=v, cluster=District, data=Cooper03)
summary(my.meta)

Alternatively, you may use the following syntax without saving the object.
summary( meta3(y=y, v=v, cluster=District, data=Cooper03) )

Since the metaSEM package is based on R, I would suggest to read the "Introduction to R" at http://cran.r-project.org/doc/manuals/r-release/R-intro.html . It may help you to get familiar with R.

Mike

Mike Cheung's picture
Offline
Joined: 10/08/2009
Hi Ning, I have tried

Hi Ning,

I have tried metaSEM_0.8-4 with R-2.15.3 in Windows and R-3.0.2 in Linux. Both worked fine.

Could you try the latest version of metaSEM at http://courses.nus.edu.sg/course/psycwlm/Internet/metaSEM/ ? If it does not work, could you please post the output of sessionInfo()? Thanks.

Mike