在R中安装插入包时的依赖性问题

use*_*123 9 r r-caret

我正在尝试安装R包 caret

哪能给我 ERROR: dependencies ‘ggplot2’, ‘reshape2’, ‘BradleyTerry2’ are not available for package ‘caret’

我试图单独安装每一个,这再次显示安装正在进行,结束消息 installation of package ‘X’ had non-zero exit status

1: In install.packages("caret") :
  installation of package ‘minqa’ had non-zero exit status
2: In install.packages("caret") :
  installation of package ‘RcppEigen’ had non-zero exit status
3: In install.packages("caret") :
  installation of package ‘scales’ had non-zero exit status
4: In install.packages("caret") :
  installation of package ‘reshape2’ had non-zero exit status
5: In install.packages("caret") :
  installation of package ‘lme4’ had non-zero exit status
6: In install.packages("caret") :
  installation of package ‘ggplot2’ had non-zero exit status
7: In install.packages("caret") :
  installation of package ‘BradleyTerry2’ had non-zero exit status
8: In install.packages("caret") :
  installation of package ‘caret’ had non-zero exit status
Run Code Online (Sandbox Code Playgroud)

递归询问安装一些包.有什么问题?

我有旧版本,我得到类似的错误.我删除并安装了最新版本.目前版本是R version 3.1.2 (2014-10-31) -- "Pumpkin Helmet",但仍然得到类似的错误消息

UPDATE

STarted:install.packages('caret', repos='http://cran.rstudio.com/')显示消息:

Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
also installing the dependencies ‘minqa’, ‘RcppEigen’, ‘scales’, ‘lme4’, ‘ggplot2’, ‘reshape2’, ‘BradleyTerry2’
Run Code Online (Sandbox Code Playgroud)

和流程以:

installing to /usr/local/lib/R/site-library/reshape2/libs
** R
** data
*** moving datasets to lazyload DB
** inst
** preparing package for lazy loading
Error : package ‘stringr’ was built before R 3.0.0: please re-install it
ERROR: lazy loading failed for package ‘reshape2’
* removing ‘/usr/local/lib/R/site-library/reshape2’
ERROR: dependencies ‘minqa’, ‘RcppEigen’ are not available for package ‘lme4’
* removing ‘/usr/local/lib/R/site-library/lme4’
ERROR: dependencies ‘reshape2’, ‘scales’ are not available for package ‘ggplot2’
* removing ‘/usr/local/lib/R/site-library/ggplot2’
ERROR: dependency ‘lme4’ is not available for package ‘BradleyTerry2’
* removing ‘/usr/local/lib/R/site-library/BradleyTerry2’
ERROR: dependencies ‘ggplot2’, ‘reshape2’, ‘BradleyTerry2’ are not available for package ‘caret’
* removing ‘/usr/local/lib/R/site-library/caret’

The downloaded source packages are in
    ‘/tmp/RtmpcLo8Rw/downloaded_packages’
Warning messages:
1: In install.packages("caret", repos = "http://cran.rstudio.com/") :
  installation of package ‘minqa’ had non-zero exit status
2: In install.packages("caret", repos = "http://cran.rstudio.com/") :
  installation of package ‘RcppEigen’ had non-zero exit status
3: In install.packages("caret", repos = "http://cran.rstudio.com/") :
  installation of package ‘scales’ had non-zero exit status
4: In install.packages("caret", repos = "http://cran.rstudio.com/") :
  installation of package ‘reshape2’ had non-zero exit status
5: In install.packages("caret", repos = "http://cran.rstudio.com/") :
  installation of package ‘lme4’ had non-zero exit status
6: In install.packages("caret", repos = "http://cran.rstudio.com/") :
  installation of package ‘ggplot2’ had non-zero exit status
7: In install.packages("caret", repos = "http://cran.rstudio.com/") :
  installation of package ‘BradleyTerry2’ had non-zero exit status
8: In install.packages("caret", repos = "http://cran.rstudio.com/") :
  installation of package ‘caret’ had non-zero exit status
Run Code Online (Sandbox Code Playgroud)

小智 9

当我安装插入包时,我有类似的问题.我发现的问题是由更新包依赖引起的.更新某些软件包也会更改其可能没有正确版本的依赖关系,以便以后在其他软件包中使用.就像我安装插入符一样,它显示:

Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) : there is no package called minqa?
Run Code Online (Sandbox Code Playgroud)

我找到的解决方案是首先找到导致问题的包.您只需安装所需的软件包即可获得此信息.对我来说,一个是"minqa".所以只需独立安装这个包.

install.packages("minqa")
Run Code Online (Sandbox Code Playgroud)

我的问题就这样解决了.

对你来说,你需要逐个安装"'minqa','RcppEigen','scale','lme4','ggplot2','reshape2','BradleyTerry2'".


小智 9

正如插入符号文档建议执行install.packages("caret", dependencies = c("Depends", "Suggests"))以确保安装所有需要的包并解决所有依赖项