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().
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
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.
Two more requirements:
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.
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?
Yes that's fine.