Error in mxVersion() : subscript out of bounds (using R 2.12.0 and OpenMx 1.0.2)

12 posts / 0 new
Offline
Joined: 07/31/2009 - 14:25
Error in mxVersion() : subscript out of bounds (using R 2.12.0 and OpenMx 1.0.2)

Hi There,
Student had problem running a script today having updated to R version 2.12.0 (2010-10-15) in order to run OpenMx 1.0.2

Model (previously running fine) came back with error:
CP_fit1 = mxRun(CP_Model1)
Running fullCommon
Error in mxVersion() : subscript out of bounds

trying mxVersion itself, I now get
mxVersion()
Error in mxVersion() : subscript out of bounds

After quitting R, and restarting... error persists

> library(OpenMx)
Attaching package: 'OpenMx'
> mxVersion()
Error in mxVersion() : subscript out of bounds

Offline
Joined: 07/31/2009 - 15:24
Did you try mxVersion() from

Did you try mxVersion() from a new R session? Your R session will do some funny things if you already have the library loaded and you try to install the new version.

Offline
Joined: 07/31/2009 - 14:25

yes, quit r, reloaded it, then started again. hence the comment "After quitting R, and restarting... error persists"

> library(OpenMx)
Attaching package: 'OpenMx'
> mxVersion()
Error in mxVersion() : subscript out of bounds

will try again tomorrow on the student's computer when she's in.
t

Offline
Joined: 07/31/2009 - 15:12
The whole of mxVersion

The whole of mxVersion consists of two lines of code, copied-and-pasted here:

libMatrix <- installed.packages()
return(libMatrix["OpenMx", "Version"])

I'd guess that 'subscript out of bounds' means 'there's nothing called "OpenMx" in the list of installed packages.' As mxRun uses mxVersion to fill the mxVersion slot in the output. Now, I don't know what to do if OpenMx doesn't appear in the list of installed packages, but it at least tells us that's where the problem is. I don't think I've seen 'attaching OpenMx' as output from a library() call, but that could be system-specific or indicate a problem with the package load. Simple test: replace mxVersion with the following code and see if mxRun works (note: replacing OpenMx functions with your own work is very very very rarely a good idea).

<code>
mxVersion <- function(){
return("Spiegel hasn't slept since R 2.11")}
Offline
Joined: 07/31/2009 - 15:24
Thanks. When I look at it,

Thanks. When I look at it, there's no reason that mxVersion() should fail hard. I forgot we include it at the end of mxRun(). I'll change it to return a NA if the library is not found.

libMatrix <- installed.packages()
if (!("OpenMx" %in% rownames(libMatrix))) return(NA)
return(libMatrix["OpenMx", "Version"])
Offline
Joined: 07/31/2009 - 15:12
Ooh, that's a better

Ooh, that's a better long-term solution. That doesn't answer the deeper question, though, which is "why isn't OpenMx in the list of installed packages?"

Offline
Joined: 07/31/2009 - 14:25
Hi Ryne... like the 2.11

Hi Ryne... like the 2.11 optimism!

This seems to be a mac build * R version 2.12.0 interaction.

I just upgraded my home laptop to 2.12, installed the OpenMx ready-to-wear version and got
> mxVersion()
Error in mxVersion() : subscript out of bounds

Built my own version from svn...
mxVersion()
[1] "999.0.0-1448"

Offline
Joined: 07/31/2009 - 14:25
OK. Solved. Installed

OK. Solved. Installed packages is for some reason detecting the wrong architecture. Turning that off works.
The off the rack version is installing for "i386", but my (and students) .Platform\$r_arch = "x86_64"

I guess too that there are a range of optimisations to be had above i386 with the gcc compilers?

Perhaps it will be worth spending some time to build a compile pool to generate more versions without poor Mike S having to guide it all manually...? Not sure.

libMatrix <- installed.packages(subarch=NULL)
> libMatrix["OpenMx",]
Package LibPath Version
"OpenMx" "/Users/tim/Library/R/2.12/library" "1.0.2-1497"
Priority Depends Imports
NA "methods" NA
NA "snowfall" NA
Built
"2.12.0"
>

Offline
Joined: 07/31/2009 - 15:24
Ah, is this a windows

Ah, is this a windows machine? We have libnpsol successfully compiled for 32-bit windows but not 64-bit windows.

Offline
Joined: 07/31/2009 - 14:25
All Macintoshes:Mini,

All Macintoshes:Mini, MacBookPro, and iMac 26 all running OS X 10.64

Offline
Joined: 07/31/2009 - 15:24
This is why we can't have

This is why we can't have nice things. Because R decides to add a new field to the package DESCRIPTION file and not put it in the documentation. OK, I just manually inserted the line into the package file. Can you have your student try installing OpenMx again using the web installer? Everything should just work.

Thanks for spotting this, sorry for doubting you earlier. That's the problem when I test on the same system I build.

Offline
Joined: 07/31/2009 - 14:25
jeez that f*in cat is scary!

jeez that f*in cat is scary! :-)

All working well now as far as i can see:

repos <- c('http://openmx.psyc.virginia.edu/packages/')
install.packages(pkgs=c('OpenMx'), repos=repos)

mxVersion()
[1] "1.0.2-1497 & smooth runnin's dr mike!"