R:ggfortify:“自动绘图不支持prcomp类型的对象" [英] R: ggfortify: "Objects of type prcomp not supported by autoplot"

查看:734
本文介绍了R:ggfortify:“自动绘图不支持prcomp类型的对象"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用ggfortify来可视化我使用prcomp所做的PCA的结果.

I am trying to use ggfortify to visualize the results of a PCA I did using prcomp.

示例代码:

iris.pca <- iris[c(1, 2, 3, 4)] 
autoplot(prcomp(iris.pca))  

错误:自动绘图不支持prcomp类型的对象.请改用qplot()或ggplot().

Error: Objects of type prcomp not supported by autoplot. Please use qplot() or ggplot() instead.

奇怪的是,自动绘图是专门为处理prcomp的结果而设计的-ggplot和qplot无法处理这样的对象.我正在运行R版本3.2,并且刚刚从这个AM的github下载了ggfortify.

What is odd is that autoplot is specifically designed to handle the results of prcomp - ggplot and qplot can't handle objects like this. I'm running R version 3.2 and just downloaded ggfortify off of github this AM.

任何人都可以解释此消息吗?

Can anyone explain this message?

推荐答案

我猜您没有加载所需的库,以下代码:

I'm guessing that you didn't load the required libraries, the code below:

library(devtools)
install_github('sinhrks/ggfortify')
library(ggfortify); library(ggplot2)
data(iris)
iris.pca <- iris[c(1, 2, 3, 4)] 
autoplot(prcomp(iris.pca))

可以工作

这篇关于R:ggfortify:“自动绘图不支持prcomp类型的对象"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆