【发布时间】:2018-12-18 03:00:19
【问题描述】:
我正在尝试将“加载”类型的对象转换为 R 中的数据框。但是,我尝试通过 as_tibble() 或 as.data.frame() 强制它没有奏效。代码如下:
iris_pca <- prcomp(iris[1:4], center = TRUE, scale. = TRUE)
iris_pca$rotation[,1:2] %>%
varimax() %>%
.$loadings
打印出来:
Loadings:
PC1 PC2
Sepal.Length 0.596 -0.243
Sepal.Width -0.961
Petal.Length 0.570 0.114
Petal.Width 0.565
PC1 PC2
SS loadings 1.00 1.00
Proportion Var 0.25 0.25
Cumulative Var 0.25 0.50
如何将这些数据放入数据框中?
【问题讨论】: