在fa()之后访问加载数据

时间:2013-03-31 08:49:22

标签: r

我有以下代码:

> require(psych)
> require(MASS)
> pa <- fa(Harman74.cor$cov,4,fm="pa" ,rotate="none")
> ld <- loadings(pa)

> str(ld)

loadings [1:24, 1:4] 0.598 0.372 0.42 0.484 0.688 ...
 - attr(*, "dimnames")=List of 2
  ..$ : chr [1:24] "VisualPerception" "Cubes" "PaperFormBoard" "Flags" ...
  ..$ : chr [1:4] "PA1" "PA2" "PA3" "PA4"

如何以4个向量或4x24数组直接访问loadings

1 个答案:

答案 0 :(得分:1)

问题不明确。 ld属于loadings类。您可以使用unclass将其转换为matrix

unclass(ld)
                             PA1         PA2          PA3          PA4
VisualPerception       0.5982838  0.02973076  0.379881903 -0.216752604
Cubes                  0.3721564 -0.03009154  0.261549017 -0.148551734
PaperFormBoard         0.4195414 -0.11770506  0.364650207 -0.125225346
Flags                  0.4840396 -0.10757757  0.260532547 -0.190122114
GeneralInformation     0.6880672 -0.29797186 -0.274215767 -0.037571574
........

但结果不一样,因为print.loadings做了一些格式化和矩阵的摘要。