为什么要在R中安装AER软件包时出现错误?

时间:2019-06-01 21:24:21

标签: r package

我正在尝试使用AER软件包中的数据集,但由于以下错误,我无法使用library("AER")

install.packages("AER")
Installing package into ‘/home/naghme/R/x86_64-pc-linux-gnu-library/3.4’
(as ‘lib’ is unspecified)
Warning in install.packages :
  dependency ‘car’ is not available
trying URL 'https://cloud.r-project.org/src/contrib/AER_1.2-6.tar.gz'
Content type 'application/x-gzip' length 2192380 bytes (2.1 MB)
==================================================
downloaded 2.1 MB

ERROR: dependency ‘car’ is not available for package ‘AER’
* removing ‘/home/naghme/R/x86_64-pc-linux-gnu-library/3.4/AER’
Warning in install.packages :
  installation of package ‘AER’ had non-zero exit status

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


> library("AER")
Error in library("AER") : there is no package called ‘AER’

2 个答案:

答案 0 :(得分:0)

https://cran.r-project.org/web/packages/car/index.html所述,汽车套件对R版本3.5.0或更高版本具有依赖性。您需要更新正在运行的R的版本。

答案 1 :(得分:0)

我遇到了同样的问题,几天后,我在链接中下载了ErdoganCEVHER建议的“ car”的最新版本:

cran.r-project.org/src/contrib/Archive/AER

我尝试手动安装:

install.packages("~/Downloads/car_3.0-2.tar.gz", repos = NULL, type = "source") 

按照他的建议,我得到了错误:

  

错误:依赖项“ carData”,“ abind”,“ pbkrtest”,“ quantreg”,“ maptools”,“ rio”,“ lme4”

我得到了错误:

  

错误:依赖项“ carData”,“ abind”,“ pbkrtest”,“ quantreg”,“ maptools”,“ rio”,“ lme4”

所以我手动安装了所有这些依赖项,然后尝试再次安装“ car”以及我需要的所有内容“ AER”,“ rdd”等,

祝您好运,谢谢大家!