I'm using the psych
package for factor analysis. I want to specify the labels of the latent factors, either in the fa()
object, or when graphing with fa.diagram()
.
For example, with toy data:
require(psych)
n <- 100
choices <- 1:5
df <- data.frame(a=sample(choices, replace=TRUE, size=n),
b=sample(choices, replace=TRUE, size=n),
c=sample(choices, replace=TRUE, size=n),
d=sample(choices, replace=TRUE, size=n))
model <- fa(df, nfactors=2, fm="pa", rotate="promax")
model
Factor Analysis using method = pa
Call: fa(r = df, nfactors = 2, rotate = "promax", fm = "pa")
Standardized loadings (pattern matrix) based upon correlation matrix
PA1 PA2 h2 u2 com
a 0.45 -0.49 0.47 0.53 2.0
b 0.22 0.36 0.17 0.83 1.6
c -0.02 0.20 0.04 0.96 1.0
d 0.66 0.07 0.43 0.57 1.0
I want to change PA1
and PA2
to FactorA
and FactorB
, either by changing the model
object itself, or adjusting the labels in the output of fa.diagram()
:
The docs for fa.diagram
have a labels
argument, but no examples, and the experimentation I've done so far hasn't been fruitful. Any help much appreciated!