package car unable to load, wrong version of nlme

五迷三道 提交于 2019-12-10 03:59:44

问题


When I try to load the 'car' package I get this error:

library(car)

Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) : 
  namespace 'nlme' 3.1-122 is already loaded, but >= 3.1.123 is required
Error: package or namespace load failed for 'car'

But when I run update.packages() there is nothing to update. I'm using MRO 3.2.3 if that matters.


回答1:


I had the same problem and solved it simply by installing nlme_3.1-123.tar.gz from https://cran.r-project.org/src/contrib/Archive/nlme/




回答2:


The ultimate cause of your problem is most likely that MRO defaults to a static repository:

By default, Microsoft R Open offers its users predictability using a static CRAN snapshot date. For example, the CRAN repository for Microsoft R Open 3.2.3 is configured to point to a snapshot date of Jan 1, 2016. Consequently, with Microsoft R Open 3.2.3 you'll always get packages as they were at midnight UTC on Jan 1, 2016 by default whenever you use install.packages.

Using a fixed CRAN repository snapshot means that every user of Microsoft R Open has access to the same set of CRAN package versions. This makes sharing R code that relies on R packages easier, and reduces the chance of incompatible R packages being installed on the same system. Learn more about fixed CRAN repository snapshots.

Try

install.packages("nlme",repos="http://cran.r-project.org")

or possibly

install.packages("nlme",repos="http://cran.r-project.org",type="binary")

(if you get a type == "both" cannot be used ... error).

Another possible source of problems with new versions of recommended packages is that one may have the old version installed in a system-level package directory, while the new version is installed in a user-level directory; check the results of

sapply(.libPaths(),packageVersion,pkg="nlme") 

and consider adding something like lib=.libPaths()[2] to your install.packages() call.



来源:https://stackoverflow.com/questions/35469385/package-car-unable-to-load-wrong-version-of-nlme

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!