Learn R Programming

misty (version 0.6.7)

write.mplus: Write Mplus Data File

Description

This function writes a matrix or data frame to a tab-delimited file without variable names, a Mplus input template, and a text file with variable names. Note that only numeric variables are allowed, i.e., non-numeric variables will be removed from the data set. Missing data will be coded as a single numeric value.

Usage

write.mplus(x, file = "Mplus_Data.dat", data = TRUE, input = TRUE,
            var = FALSE, na = -99, check = TRUE)

Value

Returns a character string indicating the variable names for the Mplus input file.

Arguments

x

a matrix or data frame to be written to a tab-delimited file.

file

a character string naming a file with or without the file extension '.dat', e.g., "Mplus_Data.dat" or "Mplus_Data".

data

logical: if TRUE (default), Mplus data file is written in a text file named according to the argumentfile.

input

logical: if TRUE (default), Mplus input template is written in a text file named according to the argumentfile with the extension _INPUT.inp.

var

logical: if TRUE, variable names are written in a text file named according to the argumentfile with the extension _VARNAMES.txt.

na

a numeric value or character string representing missing values (NA) in the data set.

check

logical: if TRUE (default), argument specification is checked.

Author

Takuya Yanagida takuya.yanagida@univie.ac.at

References

Muthen, L. K., & Muthen, B. O. (1998-2017). Mplus User's Guide (8th ed.). Muthen & Muthen.

See Also

read.mplus, mplus.run, write.sav, write.xlsx, write.dta

Examples

Run this code
if (FALSE) {
# Example 1: Write Mplus Data File and a Mplus input template
write.mplus(mtcars)

# Example 2: Write Mplus Data File "mtcars.dat" and a Mplus input template "mtcars_INPUT.inp",
# missing values coded with -999,
# write variable names in a text file called "mtcars_VARNAMES.inp"
write.mplus(mtcars, file = "mtcars.dat", var = TRUE, na = -999)
}

Run the code above in your browser using DataLab