简体   繁体   English

错误:加载插入符号包时找不到包“ggplot2”

[英]Error: Package “ggplot2” could not be found, when loading the caret package

When I install caret with. 当我安装插入符号。

install.packages("caret", dependencies=c("Depends", "Suggests"))
library(caret)
## Loading required package: lattice
## Loading required package: ggplot2

Error in LoadNamespace(i, c(lib.loc, .libPaths()), versionCheck=vI[[i]]): there is no package called 'digest' LoadNamespace中的错误(i,c(lib.loc,.libPaths()),versionCheck = vI [[i]]):没有名为'digest'的包
Error: package 'ggplot2' could not be loaded. 错误:无法加载包'ggplot2'。

So I resolve the issue with the package digest by installing caret using this code and what do I get again: 所以我通过使用此代码安装插入符来解决包摘要的问题,我又能得到什么:

install.packages("caret",  dep="TRUE")
library(caret)
## Loading required package: lattice
## Loading required package: ggplot2

Error in LoadNamespace(i, c(lib.loc, .libPaths()), versionCheck=vI[[i]]): there is no package called 'gtable' LoadNamespace中的错误(i,c(lib.loc,.libPaths()),versionCheck = vI [[i]]):没有名为'gtable'的包
Error: package 'ggplot2' could not be loaded. 错误:无法加载包'ggplot2'。

How do I install caret successfully without this kind of errors, especially the ggplot2 error! 如何在没有这种错误的情况下成功安装插入符号,尤其是ggplot2错误!

my R Version is R 3.2.2 我的R版本是R 3.2.2

Thanks guys for the help. 谢谢大家的帮助。 I did try install.packages("caret", dep="TRUE") which installed the package digest , then tried install.packages("ggplot") which installed ggplot with the dependency gtable but still had some missing packages. 我确实尝试了安装包digest install.packages("caret", dep="TRUE") ,然后尝试了install.packages("ggplot") ,它安装了ggplot和依赖gtable但仍然有一些丢失的包。 Did finally manage to load caret without any problems after installing the missing packages as prompted. 根据提示安装丢失的软件包后,最终设法加载caret没有任何问题。

You are missing some packages that ggplot2 imports (eg digest and gtable ) 您缺少ggplot2 导入的一些包(例如digestgtable

You should probably use 你可能应该使用

install.packages("caret", dependencies = c("Depends", "Imports", "Suggests"))

This should be the same as dep = TRUE but, when I use the character string above, I get all the requirements. 这应该与dep = TRUE相同,但是当我使用上面的字符串时,我得到了所有的要求。

试试这一行来安装ggplot2

install.packages('ggplot2', repos='http://cran.us.r-project.org')

在R3.2.3下安装所需的软件包及其库作为此版本中构建的插入符号,并且它适用于我。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM