I am using the lavaan
package to run multiple confirmatory factor analysis models from which I want to extract several fit measures ("chisq", "cfi", "rmsea", "srmr"). I know that I can print out these fit measures from one model at a time like this:
fitMeasures(firstmodel, fit.measures = c("chisq", "cfi", "rmsea", "srmr"))
fitMeasures(secondmodel, fit.measures = c("chisq", "cfi", "rmsea", "srmr"))
fitMeasures(thirdmodel, fit.measures = c("chisq", "cfi", "rmsea", "srmr"))
but is there a way to do all of them in one step? Maybe using the lapply
or sapply
?