Trying to complete a confirmatory factor analysis right now. Have been reading the tutorial but am unable to overcome the following error that comes after the fit command:
Error in file(file, "r") : cannot open the connection
In addition: Warning message:
In file(file, "r") : cannot open file ' independence =~ x1 + x2 + x3 + x4
therapies =~ x5': No such file or directory
Code I am using:
df <- data.frame(df.raw)
carl.model <- ' independence =~ x1 + x2 + x3 + x4
therapies =~ x5 + x6'
fit <- cfa(carl.model, data=df)
summary(fit, fit.measures = TRUE)
This is because you have another library with the same function. Specify that you are talking about lavaan
lavaan::cfa(carl.model, data=df)