Update a package and keep it from reverting to the original

谁说胖子不能爱 提交于 2019-12-21 12:29:16

问题


I want to upgrade the package ggplot2:

library(ggplot2)
packageDescription("ggplot2")["Version"]
> 0.8.3

But the current version is 0.8.7.

I tried update.packages(), which seemed to work OK. But it still returned older version 0.8.3.

So I downloaded and installed the package source from Cran, which says 0.8.7 in the download page. I then install it via the GUI menu in R. It returns

** building package indices ...
* DONE (ggplot2)

I then run:

packageDescription("ggplot2")["Version"]
> 0.8.3

And still I have the older version!

I don't know why this is not working, what's more I had already come across this problem before and solved it (I can't remember exactly what) but now it has gone back to the older version! What's the easiest way to keep packages like this updated automatically and not have them refer back to older packages?


回答1:


What version of R are you using? CRAN binaries are only kept up-to-date for the latest R release (i.e. 2.10.1). If you have an older version of R and have the development tools installed, you can use install.packages("ggplot2",type="source").




回答2:


Did you do unloadNamespace('ggplot2')? and the library(ggplot2) and then check the version? Because, once you load a package, it stays in memory of R, even though you might have already installed a newer version of the package, R does not see, until you do the above.



来源:https://stackoverflow.com/questions/2656529/update-a-package-and-keep-it-from-reverting-to-the-original

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