write.mplus {misty} | R Documentation |
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)
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., |
data |
logical: if |
input |
logical: if |
var |
logical: if |
na |
a numeric value or character string representing missing values
( |
check |
logical: if |
Value
Returns a character string indicating the variable names for the Mplus input file.
Author(s)
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
## Not run:
# 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)
## End(Not run)