||
最近在R中安装ggbiplot,遇到如下状况,此文特此记录。
安装命令根据https://github.com/vqv/ggbiplot 提示,
library(devtools) install_github("vqv/ggbiplot")
1)为此首先安装devtools包,
install.packages("devtools")
提示报错信息:
WARNING: Rtools is required to build R packages, but is not currently installed.
从https://cran.r-project.org/bin/windows/Rtools/ 下载对应版本安装,
2)随后执行
install_github("vqv/ggbiplot")
过程中,出现报错信息如下“lazy loading failed for package ‘ggbiplot’”:
google了一下解决方案,根据https://stackoverflow.com/questions/55319449/package-ggbiplot-is-not-available-for-r-version-3-5-3# 此文提示,直接尝试运行
install.packages("C:/Users/xiaobin/AppData/Local/Temp/RtmpqgjGPv/filec98460e1cfe/ggbiplot_0.55.tar.gz")
提示安装成功,输入library(ggbiplot),显示如下:
3)试运行案例
library(ggbiplot) data(wine)wine.pca <- prcomp(wine, scale. = TRUE) ggbiplot(wine.pca, obs.scale = 1, var.scale = 1, groups = wine.class, ellipse = TRUE, circle = TRUE) + scale_color_discrete(name = '') + theme(legend.direction = 'horizontal', legend.position = 'top')
图显示如下:
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2024-11-16 05:16
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社