- for(i in 1:18){fit<-'mydata[,i+19]~mydata[,i]+mydata[,i+1];mydata[,i+20]~mydata[,i]+mydata[,i+1]';model.est<-sem(fit,estimator="ML",data = mydata);resultl<-rbind(resultl,c(colnames(mydata)[i],coef(summary(model.est,fit.measures=T,standardized=T))))}
lavaan ERROR: left hand side (lhs) of this formula:
mydata[,i+19] ~ mydata[,i]+mydata[,i+1]
contains either a reserved word (in R) or an illegal character: “mydata[,i”“19]”
See ?reserved for a list of reserved words in R
Please use a variable name that is not a reserved word in R
and use only characters, digits, or the dot symbol.


雷达卡





京公网安备 11010802022788号







