Psych - Getting load factors as data.frame for exporting LaTeX

I use the psychpackage command fato analyze factors and therefore has a class object fa. I can request downloads with fac$loadings, but I only want to extract the table containing the loads, so I can use xtable(or similar) to convert it to LaTeX format.

Code example:

library(psych)
library(xtable)
data(bfi)
fac <- fa(r=cor(bfi, use="complete.obs"), nfactors=5, fm="ml", rotate="none")
fac$loadings
ld <- someMagicalFunction(fac$loadings)
xtable(ld)

Can someone tell me what I can use for someMagicalFunction?

+8
source share
3 answers

When you look fac$loading, you see that it is an S3 object. Removing a class attribute gives you matrixwhich can then be passed to xtable:

str(fac$loadings)
class(fac$loadings)

xtable(unclass(fac$loadings))
+16
source

.

fa2latex psych:

:

library(psych)
fac <- fa(bfi,5)
fa2latex(fac)

LaTeX APA.

+6

HTML xtable result. If you want to save it as a file, you can use:

print.xtable(x, type="HTML", file="table.html")
0
source

All Articles