Error in mplusModeler?

78 views
Skip to first unread message

sofia johansson

unread,
Sep 19, 2022, 5:33:15 AM9/19/22
to MplusAutomation
Hi everyone, 

I am running a  LCA-model with a distal outcome using MplusAutomation (in R). When running the code: 

m_bch <- mplusObject(
  TITLE = "BCH lca with distal outcome;",
 
  DATA = "LISTWISE=ON;",
 
  VARIABLE =
    "IDVARIABLE = case_id;
    usevar = int_3 sw_3 soc_3 alt_3 gov_3 for_3;
    auxiliary = claim_5 (bch);
    classes = c(5);",
 
  ANALYSIS =
    "estimator = mlr;
    type = mixture;
    starts = 500 100;
    processors = 10;",
 
  SAVEDATA =
    "File= lca_distal_c5.dat;
    Save=cprob;",
 
  OUTPUT = "sampstat residual tech11 tech14;",
 
  usevariables = c("int_3", "sw_3", "soc_3", "alt_3", "gov_3", "for_3", "claim_5", "claim_6"),
  rdata =  data_lca_distal_Mpanel_220918_no_cov_)

m_bch_fit <- mplusModeler(m_bch,
                          dataout=here("paper 2"),
                          modelout=here("paper 2"),
                          check=TRUE, run = TRUE, hashfilename = FALSE)

I get the error code: 

Error in vapply(df, class, FUN.VALUE = NA_character_) :
  values must be length 1,
 but FUN(X[[1]]) result is length 3

I thought i might be due to the NA-values. I therefore recoded all NA values in the data frame to -9999 and specified in the code: MISSING ARE ALL -999. In addition, I added  Missflag= 9999 under SAVE DATA. This did, however, not solve the issue and I get the same error message when running the updated code/data frame. Does anyone know why this error occurs and how it can be solved? 

I would appreciate any help with this! Also, I am new to this group so please let me know if you need any other information in order to discuss this. 

Thanks in advance,
Sofia
Reply all
Reply to author
Forward
0 new messages