AutoPlot不支持PRCOMP类型的对象
我有多个列的数据框。我想进行PCA并与决策树进行分类,以检查iL.count.ratio上的信息是否到une.count.ratio实际上可以帮助区分这两个专业。
Profession il.count.ratio elle.count.ratio un.count.ratio une.count.ratio
secretary 1.7241 1.3514 1.473 0.7380
secretary 0.0000 2.8736 2.8536 0.8370
driver 1.7065 0.0000 0.0000 0.7380
driver 0.5284 1.4733 0.7380 0.5280
输出为:autoplot()
中的错误: 呢AutoPlot不支持PRCOMP的对象。
有人知道可能是什么问题?
data %>%
select(il.count.ratio:une.count.ratio) %>%
prcomp() %>%
autoplot(data = data,
colour = 'Profession',
loadings = TRUE,
loadings.colour = "blue",
loadings.label = TRUE,
loadings.label.colour = "blue")
I have a data frame of multiple columns. I want to carry out PCA and classification with decision trees to check if information on il.count.ratio to une.count.ratio can actually help to differentiate the two professions.
Profession il.count.ratio elle.count.ratio un.count.ratio une.count.ratio
secretary 1.7241 1.3514 1.473 0.7380
secretary 0.0000 2.8736 2.8536 0.8370
driver 1.7065 0.0000 0.0000 0.7380
driver 0.5284 1.4733 0.7380 0.5280
output is : Error in autoplot()
:
! Objects of type prcomp not supported by autoplot.
someone know what may be the problem ?
data %>%
select(il.count.ratio:une.count.ratio) %>%
prcomp() %>%
autoplot(data = data,
colour = 'Profession',
loadings = TRUE,
loadings.colour = "blue",
loadings.label = TRUE,
loadings.label.colour = "blue")
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用Broom的
增强
(用于PC)和整理
(用于加载)在ggplot
ing之前获取数据框:在2022-06-30创建的 reprex软件包(v2.0.1)
You could use broom's
augment
(for the PCs) andtidy
(for the loadings) to get a dataframe beforeggplot
ing:Created on 2022-06-30 by the reprex package (v2.0.1)