model$intervals = NULL
doesn't error, but it does nothing (the interval requests remain)
model@intervals = NULL
fails with an error:
Error in checkAtAssignment("MxModel", "intervals", "NULL") :
assignment of an object of class “NULL” is not valid for @‘intervals’ in an object of class “MxModel”;
It would be nice if the $ operator allowed removing CI requests from models.
Currently (for reasonable reasons), adding a CI request doesn't step on the existing ones, so they just accumulate with no obvious way to remove potentially expensive but unwanted CI requests.
Comments
#1
UPDATE: with OpenMx version: 2.5.2 [GIT v2.5.2]
model$intervals = NULL
Now gives an informative error.
Error: I'm very sorry, but direct modification of objects inside an mxModel is not supported. The recommended approach to modifying an mxMatrix, mxAlgebra or other object within a model is to rebuild the mxModel. So, for example, 'model <- mxModel(model, Something)' can be used to replace Something inside the model, instead of 'model$Something <- Something' which does not work
#2
Try
model@intervals <- list()
.#3
duplicate