if (FALSE) {
#----------------------------------------------------------------------------
# Example 1: Update VARIABLE and MODEL section
# Write Mplus Data File
write.mplus(ex3_1, file = "ex3_1.dat")
# Specify Mplus input
input <- '
DATA: FILE IS ex3_1.dat;
VARIABLE: NAMES ARE y1 x1 x3;
MODEL: y1 ON x1 x3;
OUTPUT: SAMPSTAT;
'
# Run Mplus input
mod0 <- mplus(input, file = "ex3_1.inp")
# Update VARIABLE and MODEL section
update1 <- '
VARIABLE: ...;
USEVARIABLES ARE y1 x1;
MODEL: y1 ON x1;
'
# Run updated Mplus input
mod1 <- mplus.update(mod0, update1, file = "ex3_1_update1.inp")
#----------------------------------------------------------------------------
# Example 2: Update ANALYSIS section
# Update ANALYSIS section
update2 <- '
ANALYSIS: ESTIMATOR IS MLR;
'
# Run updated Mplus input
mod2 <- mplus.update(mod1, update2, file = "ex3_1_update2.inp")
#----------------------------------------------------------------------------
# Example 3: Remove OUTPUT section
# Remove OUTPUT section
update3 <- '
OUTPUT: ---;
'
# Run updated Mplus input
mod3 <- mplus.update(mod2, update3, file = "ex3_1_update3.inp")
}
Run the code above in your browser using DataLab