The function parses a character string containing Mplus code and checks that every non blank line ends in either a colon or a semicolon. In addition, it checks that every line is less than 90 characters, because Mplus ignores everything after 90 characters on a line which can be a source of enigmatic errors.
a character string containing Mplus code.
logical indicating whether or not to add semicolons to
lines that do not have them. Defaults to
The function is fairly basic at the moment. It works by simply removing blank space (spaces, tabs, etc.) and then if a line does not terminate in a colon or semicolon, it returns a note and the line number. Optionally, it can add semicolons to any lines missing them and return the input with added semicolons. To check for lines that are too long, all trailing (but not before) white space is removed, and then the number of characters is checked.
a character vector containing the input text and optionally added semicolons.
Joshua F. Wiley <[email protected]>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
# sample input test <- " MODEL: mpg ON wt hp; wt WITH hp " # check and return cat(parseMplus(test), file=stdout(), fill=TRUE) # add missing semicolons and return cat(parseMplus(test, TRUE), file=stdout(), fill=TRUE) test <- " MODEL: mpg cyl disp hp drat wt qsec vs am gear PWITH cyl disp hp drat wt qsec vs am gear carb; " cat(parseMplus(test), file=stdout())
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.