library(knitr)

Interested in quicky creating formatted tables and plots for factor analysis?

The data

library(tidyverse)
library(psycho)
library(psych)


df <- psych::bfi %>%
  select(-gender, -education, -age) %>%
  na.omit() %>%
  mutate_all(as.numeric)

psycho::n_factors(df)

The Method Agreement Procedure suggests to retain 5 factors.

Do the EFA

fa <- psych::fa(df, nfactors=5)
results <- analyze(fa)

Loadings Table

summary(results)
knitr::kable(summary(results), digits=2)

Running a summary on the analyzed fa object returns a dataframe, which is convenient to save, manipulate or enjoy.

Loadings Plot

plot(results)

Lavaan-ready Model for CFA

print(results)

analyze(fa, treshold=0.2)

Contribute

psycho is a young package in need of affection. Therefore, if you have any advices, opinions or such, we encourage you to either let us know by opening an issue, or by contributing to the code.

Credits

This package helped you? Don't forget to cite the various packages you used :)

You can cite psycho as follows:

Previous blogposts



neuropsychology/psycho.R documentation built on Jan. 25, 2021, 7:59 a.m.