Learn R Programming

OpenMx (version 2.7.9)

mxRename: Rename MxModel or a Submodel

Description

This functions renames either the top model or a submodel to a new name. All internal references to the old model name are replaced with references to the new name.

Usage

mxRename(model, newname, oldname = NA)

Arguments

model
a MxModel object.
newname
the new name of the model.
oldname
the name of the target model to rename. If NA then rename top model.

Value

Return a mxModel object with the target model renamed.

References

The OpenMx User's guide can be found at http://openmx.ssri.psu.edu/documentation.

Examples

Run this code

library(OpenMx)

# create two empty models
modelA <- mxModel(model='modelA')
modelB <- mxModel(model='modelB')

# create a parent model with two submodels
modelC <- mxModel(model='modelC', modelA, modelB)

# Rename modelC to model1
model1 <- mxRename(modelC, 'model1')

# Rename submodel modelB to model2
model1 <- mxRename(model1, oldname = 'modelB', newname = 'model2')

model1

Run the code above in your browser using DataLab