I can't figure out a way to get rid of this error in my R script.
I prepared Data in R and then wanted to use the prepareMplusData function, which works well until I standardize a variable.
setwd (...)
install.packages("merTools")
library(merTools)
data(hsb)
install.packges("MplusAutomation")
library(MplusAutomation)
prepareMplusData(hsb, "Mydata.dat") #it works now!
hsb$mathach <- scale(hsb$mathach)
prepareMplusData(hsb, "Mydata_scales.dat") #now I get the error term
As soon as I scale my Data and try to use the prepareMplusData function, I get the following error:
Error in vapply(df, class, FUN.VALUE = NA_character_) :
values must be length 1,
but FUN(X[[110]]) result is length 2
What can I do now? I never explicitly wrote the vapply code, so I assume, this is part of another function. How do I standardize my Data in a way, that I can export my Data to an Mplus format?
I found out how to fix it. just needed to specify the standardized variable to a numeric