I am using Mplusautomation to run a LCA with a distal outcome in R. Both the indicators and the distal are ordinal variables, with scales ranging from 1 to 5 for the indicator variables and 1 to 4 for the distal variables.
TITLE = "BCH lca with distal outcome;",
DATA = "LISTWISE=ON;",
VARIABLE =
"usevar = int_3 sw_3 soc_3 alt_3 gov_3 for_3;
auxiliary = claim_5 claim_6 (bch);
classes = c(5);",
ANALYSIS =
"estimator = mlr;
type = mixture;
starts = 500 100;
processors = 10;",
OUTPUT =
"type = plot3;
series = int_3 sw_3 soc_3 alt_3 gov_3 for_3(*);",
usevariables = c("int_3", "sw_3", "soc_3", "alt_3", "gov_3", "for_3", "claim_5", "claim_6"),
rdata = data_lca_distal_Mpanel_220918)
m_bch_fit <- mplusModeler(m_bch,
dataout=here("paper 2"),
modelout=here("paper 2"),
check=TRUE, run = TRUE, hashfilename = FALSE)
However, when I run the code I get the following error message:
Error in vapply(df, class, FUN.VALUE = NA_character_) : values must be length 1, but FUN(X[[1]]) result is length 3
I am new to Mplus and R and have no idea what this error means. I extracted the indicators to a data frame without NA's, and to a data frame with NA = -99 (defining MISSING ARE ALL -99 in the code). However, that did not work and the error still appears. Does anyone know why this error appears and what I can do about it? I really appreciate any help on this matter.
Thank you!