data = psych::bfi
EFA(data, "E", 1:5) # var + items
EFA(data, "E", 1:5, nfactors=2) # var + items
EFA(data, varrange="A1:O5",
nfactors="parallel",
hide.loadings=0.45)
# the same as above:
# using dplyr::select() and dplyr::matches()
# to select variables whose names end with numbers
# (regexp: \d matches all numbers, $ matches the end of a string)
data %>% select(matches("\\d$")) %>%
EFA(vars=names(.), # all selected variables
method="pca", # default
rotation="varimax", # default
nfactors="parallel", # parallel analysis
hide.loadings=0.45) # hide loadings < 0.45
Run the code above in your browser using DataLab