Car package not found by R (failed to load)

2019-05-28 13:11发布

I am am trying to load a simple dataset using:

library(car)

but I get the following error:

Error in library("car") : there is no package called 'car'

Does anyone have an idea why this happens and how to solve it?

标签: r r-car
6条回答
做个烂人
2楼-- · 2019-05-28 13:30

I know this post was from several months ago, but I came across it after having the same issue. I followed the instructions here (it's a .doc download).

I typically use R Studio, but was having no luck with this:

install.packages("car") 

I opened the R application (not Studio) and followed the instructions on the .doc. I now have the package. Good luck!

查看更多
\"骚年 ilove
3楼-- · 2019-05-28 13:32

If you don't currently use an IDE (or even if you do), the following will install the package:

install.packages("car")

Before then running

library("car")

You should heed @Iris's advice and use a RStudio if you don't already to manage just this sort of task.

查看更多
欢心
4楼-- · 2019-05-28 13:40

For security purposes, I use R in a standard account on a Mac and download packages via a separate admin account. Yesterday I updated Microsoft R Open from 3.2.2 to 3.2.3 and I got this message when I tried to load Rcmdr:

Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) : namespace ‘nlme’ 3.1-122 is being loaded, but >= 3.1.123 is required
Error: package ‘car’ could not be loaded

I had to log in to my admin account and check for updates. There was one for nlme, that I installed and that allowed car to load.

查看更多
迷人小祖宗
5楼-- · 2019-05-28 13:40

This worked for me. After downloading the most stable version of R (3.4.4), first, I install.packages("car",dependencies=TRUE) then install all the packages that when loading car I was asked for like haven, foreign, etc. So I installed them separately. Also, I noticed that when I install the packages they go to win-library folder instead of the actual working folder (the packages go to R\win-library\3.4 instead of R\R-3.4.4. So I copied them to the right folder.

查看更多
冷血范
6楼-- · 2019-05-28 13:43

You forgot to install the package before you tried to load it.

Do you use a IDE (integrated development environment)? I can strongly recommmand the use of Rstudio as IDE. When you installed Rstudio, you can choose in the toolbar: "Tools" > "Install packages..." Type in "car" and click "install". As soon as the package is installed, you can load the package with library(car)

查看更多
戒情不戒烟
7楼-- · 2019-05-28 13:44

I used Tools/Install packages... from R Studio and chose not to compile from source and do this for several packages it complains missing. And it works!

查看更多
登录 后发表回答