在R中安装软件包:安装"中介"尽管依赖关系是最新的

时间:2015-04-24 15:41:58

标签: r installation cran

我正在尝试安装mediation包。但是,由于缺少依赖性,这会失败:

> install.packages("mediation")
Installing package into ‘/home/simoncolumbus/R/i686-pc-linux-gnu-library/3.0’
(as ‘lib’ is unspecified)
trying URL 'http://cran.rstudio.com/src/contrib/mediation_4.4.4.tar.gz'
Content type 'application/x-gzip' length 1463736 bytes (1.4 Mb)
opened URL
==================================================
downloaded 1.4 Mb

* installing *source* package ‘mediation’ ...
** package ‘mediation’ successfully unpacked and MD5 sums checked
** R
** data
*** moving datasets to lazyload DB
** demo
** inst
** preparing package for lazy loading
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) : 
  namespace ‘lattice’ 0.20-24 is already loaded, but >= 0.20.27 is required
Error : package ‘sandwich’ could not be loaded
ERROR: lazy loading failed for package ‘mediation’
* removing ‘/home/simoncolumbus/R/i686-pc-linux-gnu-library/3.0/mediation’
Warning in install.packages :
  installation of package ‘mediation’ had non-zero exit status

The downloaded source packages are in
    ‘/tmp/RtmpWpmJqS/downloaded_packages’

这有点令人惊讶,因为格子和三明治,以及动物园(称为格子)都是最新的:

> installed.packages()
lattice      "lattice"      "/home/simoncolumbus/R/i686-pc-linux-gnu-library/3.0" "0.20-31"   "recommended"
sandwich     "sandwich"     "/home/simoncolumbus/R/i686-pc-linux-gnu-library/3.0" "2.3-3"     NA
zoo          "zoo"          "/home/simoncolumbus/R/i686-pc-linux-gnu-library/3.0" "1.7-12"    NA

我已经尝试卸载软件包,更新它们,通过软件包管理器安装它们 - 但似乎没有任何影响。有什么建议吗?

编辑:通过更新到R的最新可用版本来解决问题;必须与我运行的旧版本不兼容,导致这种情况。

1 个答案:

答案 0 :(得分:0)

退出R.删除.Rdata文件。重新开始。 .Rdata文件能够保存和加载包。