Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

update.mplusObject

Update an Mplus model object


Description

This is a method for updating an Mplus model object. It takes an Mplus model object as the first argument, and then optionally any sections to update. There are two ways to update a section using a formula interface. ~ "new stuff" will replace a given section with the new text. Alternately, you can add additional text using ~ + "additional stuff". Combined these let you replace or add to a section.

Usage

## S3 method for class 'mplusObject'
update(object, ...)

Arguments

object

An object of class mplusObject

...

Additional arguments to pass on

Value

An (updated) Mplus model object

Author(s)

Joshua F. Wiley <jwiley.psych@gmail.com>

Examples

example1 <- mplusObject(MODEL = "mpg ON wt;",
  usevariables = c("mpg", "hp"), rdata = mtcars)
x <- ~ "ESTIMATOR = ML;"
str(update(example1, rdata = iris))
str(update(example1, ANALYSIS = x))
str(update(example1, MODEL = ~ "wt ON hp;"))
str(update(example1, MODEL = ~ . + "wt ON hp;"))
str(update(example1, ANALYSIS = x, MODEL = ~ . + "wt ON hp;"))

## check that use variables can be updated & over ridden
str(update(example1, usevariables = c("mpg", "hp", "cyl")))

# test to make sure . in Mplus code does not cause problems
str(update(example1, ANALYSIS = x, MODEL = ~ . + "wt ON hp*.5;"))
rm(example1, x)

MplusAutomation

An R Package for Facilitating Large-Scale Latent Variable Analyses in Mplus

v0.8
LGPL-3
Authors
Michael Hallquist [aut, cre], Joshua Wiley [aut], Caspar van Lissa [ctb], Daniel Morillo [ctb]
Initial release
2020-09-28

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.