# REMEMBER, YOU MUST NAMED ALL ARGUMENT EXCEPT THE CFA ITEMS ARGUMENT
# Fitting a multilevel single factor CFA model
fit <- cfa_summary(
data = lavaan::HolzingerSwineford1939,
x1:x3,
x4:x6,
x7:x9,
group = "sex",
model_variance = FALSE, # do not print the model_variance
model_covariance = FALSE # do not print the model_covariance
)
# Fitting a CFA model by passing explicit lavaan model (equivalent to the above model)
# Note in the below function how I added `model = ` in front of the lavaan model.
# Similarly, the same rule apply for all arguments (e.g., `ordered = FALSE` instead of just `FALSE`)
# \donttest{
fit <- cfa_summary(
model = "visual =~ x1 + x2 + x3",
data = lavaan::HolzingerSwineford1939,
quite = TRUE # silence all output
)
# }
if (FALSE) {
# This will fail because I did not add `model = ` in front of the lavaan model.
# Therefore,you must add the tag in front of all arguments
# For example, `return_result = 'model'` instaed of `model`
cfa_summary("visual =~ x1 + x2 + x3
textual =~ x4 + x5 + x6
speed =~ x7 + x8 + x9 ",
data = lavaan::HolzingerSwineford1939
)
}
Run the code above in your browser using DataLab