Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in v0.8? #130

Closed
cbratt opened this issue Oct 29, 2020 · 3 comments
Closed

Bug in v0.8? #130

cbratt opened this issue Oct 29, 2020 · 3 comments
Assignees
Labels

Comments

@cbratt
Copy link

cbratt commented Oct 29, 2020

I believe there might be a bug in MplusAutomation's use of the update() function, introduced in v0.8.

Define a linear regression model for Mplus, using MplusAutomation and built-in data in R, then run the model.

library(MplusAutomation)
test_model <- mplusObject(VARIABLE = "usevariables = mpg cyl;",
                   MODEL = "mpg ON cyl;",
                   rdata = mtcars)

mplusModeler(test_model,
             hashfilename = F,
             modelout = "test_model.inp",
             dataout = "mplusdata.dat",
             run =   1L
)
unlink("test_model.inp")

No problem so far.

Now define the same model as above, but leave out the data. Then add the data using update(), and try to run the model.

test_model2 <- mplusObject(VARIABLE = "usevariables = mpg cyl;",
                   MODEL = "mpg ON cyl;"
                   )

test_model3 <- update(test_model2,
                          rdata = mtcars)

mplusModeler(test_model3,
             hashfilename = F,
             modelout = "test_model3.inp",
             dataout = "mplusdata.dat",
             run =   1L
)

The last command results in the following error message:

When hashfilename = FALSE, writeData cannot be 'ifmissing', setting to 'always'
Wrote model to: test_model3.inp
Wrote data to: mplusdata.dat
Error in .cleanHashData(df = df, keepCols = keepCols, imputed = imputed) : 
  missing(keepCols) || is.character(keepCols) || is.numeric(keepCols) ||  .... is not TRUE

Best,
Christopher Bratt

@michaelhallquist
Copy link
Owner

Thanks for these details, Chris. @JWiley , would you be able to look at this as time permits?

@JWiley
Copy link
Collaborator

JWiley commented Nov 8, 2020

Thanks, I think it was never built to not have an R dataset in the original object.
Should be fairly easy to fix, thanks for the report.

@JWiley JWiley self-assigned this Nov 8, 2020
@JWiley JWiley added the bug label Nov 8, 2020
@cbratt
Copy link
Author

cbratt commented Nov 9, 2020

Works like a charm in previous versions. And sometimes I even need to wait with providing the data so update() will update added variables correctly.

Thanks for the effort!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants