Friday, August 24, 2012

How to Roll Back Packages in R

Today I was in an unusual position where changes to a common dependency in one R package broke compatibility with several other packages I use for predictive modeling.  When I went to roll back the package, I was surprised to learn that there is no option to install.packages which will simply install a version of my choice.  Instead, Matt taught me a rather simple and straightforward way to install an earlier version using Hadley's devtools package.  The first step is to install the package and load it:

install.packages("devtools")
library(devtools)


Next, I can look up the package and version of my choice on the CRAN archive.

Finally, once I find the package and version I want, I can copy the link from the CRAN archive and use.  For example,

install_url("http://cran.r-project.org/src/contrib/Archive/survival/survival_2.36-12.tar.gz")

Just like that, I've rolled back the package to an earlier version.  Thanks to Matt for introducing me Hadley's useful devtools package!

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.