I have a data frame such as follows:
x <- c(1, 2, 1, 2)
y <- c(1, 2, 3, 4)
z <- c(4, 3, 2, 1)
df <- data.frame(x, y, z)
I am running a factor analysis with the fa
funciton from the psych
package:
fit <- fa(df, nfactors = 2)
fit$loadings
This results in the following output:
Loadings:
MR1 MR2
x 0.448
y 0.999
z -0.999
MR1 MR2
SS loadings 2.195 0.000
Proportion Var 0.732 0.000
Cumulative Var 0.732 0.732
I would like to save the table with MR1 and MR2 as a data frame. Does anyone know how could this be done? Thank you.
I believe the short answer should simply be:
as.data.frame(unclass(fit$loadings))
Giving:
MR1 MR2
x 0.4502976 0.10314193
y 0.9984784 -0.02325767
z -0.9984784 0.02325767