首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >安装ggplot2时出错

安装ggplot2时出错
EN

Stack Overflow用户
提问于 2014-03-29 03:52:04
回答 3查看 9K关注 0票数 3

我试图在ggplot2上运行一个简单的代码,得到了以下错误:

代码语言:javascript
复制
source("u1.txt")
Error in library(ggplot2) : there is no package called ‘ggplot2’


Error : package ‘foreign’ was built before R 3.0.0: please re-install it
ERROR: lazy loading failed for package ‘maptools’
* removing ‘/home/shivangi/R/i686-pc-linux-gnu-library/3.0/maptools’
* installing *source* package ‘multcomp’ ...
** package ‘multcomp’ successfully unpacked and MD5 sums checked
** R
** data
*** moving datasets to lazyload DB
** demo
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
* DONE (multcomp)
ERROR: dependencies ‘plyr’, ‘reshape2’, ‘scales’ are not available for package ‘ggplot2’
* removing ‘/home/shivangi/R/i686-pc-linux-gnu-library/3.0/ggplot2’

The downloaded source packages are in
    ‘/tmp/RtmpOGWrr4/downloaded_packages’
Warning messages:
1: In install.packages("ggplot2", dep = TRUE) :
  installation of package ‘Rcpp’ had non-zero exit status
2: In install.packages("ggplot2", dep = TRUE) :
  installation of package ‘plyr’ had non-zero exit status
3: In install.packages("ggplot2", dep = TRUE) :
  installation of package ‘testthat’ had non-zero exit status
4: In install.packages("ggplot2", dep = TRUE) :
  installation of package ‘reshape2’ had non-zero exit status
5: In install.packages("ggplot2", dep = TRUE) :
  installation of package ‘scales’ had non-zero exit status
6: In install.packages("ggplot2", dep = TRUE) :
  installation of package ‘Hmisc’ had non-zero exit status
7: In install.packages("ggplot2", dep = TRUE) :
  installation of package ‘maptools’ had non-zero exit status
8: In install.packages("ggplot2", dep = TRUE) :
  installation of package ‘ggplot2’ had non-zero exit status
EN

回答 3

Stack Overflow用户

发布于 2014-08-08 03:33:51

今天晚上运行ggplot时也发生了同样的错误,本质上您需要尝试安装所有失败的依赖项。对我来说,这是“尺度”,然后是“芒塞尔”,最后是(实际的问题)“颜色空间”,自从我升级到3.1.1之后就没有更新过。在您的示例中,您似乎希望先尝试安装"foreign“,然后再试一次ggplot2。继续手动加载该错误的依赖项,直到找到真正的问题为止。

票数 1
EN

Stack Overflow用户

发布于 2016-04-26 06:51:58

您可以指定install.packages()调用还安装所有依赖的包:

代码语言:javascript
复制
if(!require(ggplot2)) install.packages('dplyr',dependencies = TRUE)

上面的代码首先检查是否加载了ggplot2包,如果没有,则尝试加载apckage。如果无法加载包,则尝试安装包和所有包的依赖项。

票数 0
EN

Stack Overflow用户

发布于 2017-05-06 20:39:22

安装了RTools之后,我就可以使用它了:

代码语言:javascript
复制
install.packages("ggplot2", type="source",dependencies = TRUE)

汇编了一些软件包..。

确保您的路径被更新为正确指向RTools,即包括

代码语言:javascript
复制
c:\Rtools\bin;c:\Rtools\gcc-4.6.3\bin

在前面。

我正在使用Rtools32.exe

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/22726764

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档