General strategies
Posted on

Forums
- Use the traceback() function in R after an error occurs.
It will print out the sequence of function calls that lead to the error. - Simplify your code. This may help you locate an error more easily. For example, replace the following:
foo <- mxModel(mxMatrix('Full', 1, 2, name = 'a'), mxAlgebra(a + a, 'b'), mxAlgebraObjective('b'))
with:
aMatrix <- mxMatrix('Full', 1, 2, name = 'a') bAlgebra <- mxAlgebra(a + a, name = 'b') objective <- mxAlgebraObjective('b') model <- mxModel(aMatrix, bAlgebra, objective)