OpenMx script requirements

6 replies [Last post]
mspiegel's picture
Offline
Joined: 07/31/2009

The files UnivariateTwinAnalysis20090925.R, Twin_independent_path_general_factor.R, TwinAnalysis_Multivariate_Matrix_Raw.R, and NTF_design.R are being moved to the models/failing directory in preparation for the next closed beta release. All files in the test suite must follow the following guidelines:

  • Never use setwd(). It's not going to work on my machine.
  • Never use source(). The point of a demo is that the entire example is in a single file.
  • Never use read.table(). It's not going to work in my current working directory. Use the data() command instead.
  • Undefined variables are bad.
  • All demos and files in models/passing MUST contain some omxCheck....() function. The most common call is to omxCheckCloseEnough().
mspiegel's picture
Offline
Joined: 07/31/2009
Files in the models/passing

Files in the models/passing directory are executed in the models/passing directory. Which means that read.table() is allowed, the data file should be placed in the models/passing/data directory. And source() is also allowed, as long as a relative path is used.

tbates's picture
Offline
Joined: 07/31/2009
given that during development

given that during development files might live in /failing and once passing they might also be copied out to demo/ (as many passing models are) then perhaps it makes sense to stick to using data() even in passing, so we don't end up with copies of the data in different places, possibly in different forms?

mspiegel's picture
Offline
Joined: 07/31/2009
Yes that's fine.

Yes that's fine.

mspiegel's picture
Offline
Joined: 07/31/2009
Two more requirements: All

Two more requirements:

  • All demos must have an entry in the 00INDEX file. Run "make check" to see if the 00INDEX file is correct.
  • It is strongly recommended NOT to place URLs in a demo or test script. These scripts should work, for example, on an airplane without internet access.
tbates's picture
Offline
Joined: 07/31/2009
data() seems much more

data() seems much more limited in handling files.

In particular, the example files currently use old-mx's missing char ".", which can't be handled in data() as far as I can see.

I can replace "." with NA after loading, but I see now that data() converts data to factors in the process...

I'll change the missing in one file to NA and see if that works better

mspiegel's picture
Offline
Joined: 07/31/2009
The read.table() versus

The read.table() versus data() issue is not a matter of preference. read.table() reads from either an absolute path (which we can't use on other people's machines) or a relative path (which we can't use on other people's machines because we don't know what is their current working directory). data() always reads data from the /data directory within the OpenMx package installation. So whatever data is used for demos must be translated to a format that can be used for demos.