HS.model <- ' visual =~ x1 + x2 + x3 + textual =~ x4 + x5 + x6 + speed =~ x7 + x8 + x9' > cfa(HS.model, data=HolzingerSwineford1939) Error in file(file, "r") : cannot open the connection In addition: Warning message: In file(file, "r") : cannot open file ' visual =~ x1 + x2 + x3 textual =~ x4 + x5 + x6 speed =~ x7 + x8 + x9': Invalid argument
Could anyone help me, please?
--
You received this message because you are subscribed to the Google Groups "lavaan" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lavaan+un...@googlegroups.com.
To post to this group, send email to lav...@googlegroups.com.
Visit this group at https://groups.google.com/group/lavaan.
For more options, visit https://groups.google.com/d/optout.
--
I am guessing you loaded the sem
package as well. You need to unload it or whatever package is conflicting with the cfa()
or type lavaan::cfa()
. This code reproduces your message
library(lavaan)
library(sem) # tells us cfa() and sem() are masking the functions in lavaan
HS.model <- ' visual =~ x1 + x2 + x3
textual =~ x4 + x5 + x6
speed =~ x7 + x8 + x9 '
fit <- cfa(HS.model, data=HolzingerSwineford1939)
# unload the sem package
detach("package:sem", unload = TRUE)
# works as expected
fit <- cfa(HS.model, data=HolzingerSwineford1939)
## Alternatively leaving sem loaded
library(lavaan)
library(sem)
HS.model <- ' visual =~ x1 + x2 + x3
textual =~ x4 + x5 + x6
speed =~ x7 + x8 + x9 '
fit <- lavaan::cfa(HS.model, data=HolzingerSwineford1939) # the sem cfa() function masked the lavaan cfa() function
And I mean you loaded the sem
package AFTER the lavaan
package.