michaelhallquist / MplusAutomation

The MplusAutomation package leverages the flexibility of the R language to automate latent variable model estimation and interpretation using Mplus, a powerful latent variable modeling program developed by Muthen and Muthen (www.statmodel.com). Specifically, MplusAutomation provides routines for creating related groups of models, running batches of models, and extracting and tabulating model parameters and fit statistics.
84 stars 46 forks source link

Truncating File Path in Input Syntax #184

Closed dinanajiarch closed 8 months ago

dinanajiarch commented 1 year ago

Hello,

I am curious if there is a way to truncate the file path in the input syntax using mplusObject. My working project is within a few folders, and I am not able to estimate the model without getting the error:

*** WARNING Input line exceeded 90 characters. Some input may be truncated.

When working in Mplus directly, I can run the model with the file command as just the name of the .dat file (with out the long file path). Is this possible using MplusAutomation? This is what my code looks like now:

lca_6  <- lapply(1:6, function(k) {
  lca_enum  <- mplusObject(

    TITLE = glue("{k}-Class"), 

    VARIABLE = glue(
    "categorical = report_dis-law_fte; 
     usevar = report_dis-law_fte;
     classes = c({k}); "),

  ANALYSIS = 
   "estimator = mlr; 
    processors = 10;",

  OUTPUT = "sampstat residual tech11 tech14;",

  usevariables = colnames(df_bully),
  rdata = df_bully)

lca_enum_fit <- mplusModeler(lca_enum, 
                            dataout=glue(here("enum", "bully.dat")),
                            modelout=glue(here("enum", "c{k}_bully.inp")) ,
                            check=TRUE, run = TRUE, hashfilename = FALSE)
})

Thanks for your help.

Dina

michaelhallquist commented 8 months ago

Thanks for this, Dina. The mplusModeler and prepareMplusData commands were not wrapping long file paths, leading to this error. I just pushed commit 92c0014, which fixes this problem.