[R] Old packages to updated R

Prof Brian Ripley ripley at stats.ox.ac.uk
Mon Oct 8 08:47:49 CEST 2007

The standard advice is to use a separate library for packages you install.
R '2.60' is a long way off, so I am unable to predict what the advice will 
be if it ever comes out.

Currently you can do

tmp <- installed.packages()
inst <- as.vector(tmp[is.na(tmp[,"Priority"]), 1])
save(inst, file="/tmp/inst.rda")

in the old version to get a list of packages you installed.  Then in the 
new version,


If you have created a personal or site library, the latter will use that 
for installation: next time around all you need to do is to copy that 
library to the new version and issue


On Sun, 7 Oct 2007, Jon Loehrke wrote:

> I am 100% positive there is a better fix for this problem and it has been
> discussed.  Thank you in advance for bringing it to my attention.
> When upgrading to newer versions of R the old packages are not brought
> along in the process.  I solved that problem by creating a list of the
> packages in the old version of R, importing them to the new version via a
> CSV, and re-installing into the newer R directory.  The script is below.
> Is there a more efficient way to do this?  Should I simply attempt to drag
> the package folders from the old directory to the new one?  Thanks

No, as they should be reinstalled for a new version of R.

> ## in old version of R<2.6
> package<-c(library())
> write.csv(package$results, file="file path/oldpackages.csv")
> ##**  Update R or open updated R version (R=2.60)
> package.list<-read.csv(file="file path/oldpackages.csv", header=TRUE)
> package.list$Package<-as.character(package.list$Package)
> install.packages(c(package.list$Package)) #wait awhile and ignore errors
> for base packages.
> system:  Mac powerbook intel duo.  Latest OS R 2.60 [now, thanks to
> everyone involved]
> Jon Loehrke
> Fisheries Graduate Research Assistant
> School for Marine Science and Technology
> UMASS-Dartmouth
> 838 S. Rodney French Blvd.
> New Bedford, MA 02744
> Phone: 508-910-6393
> Fax:   508-910-6396
> "Opportunity is missed by most people because it is dressed in overalls
> and looks like work."
> --Thomas A. Edison
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

It seems you missed the opportunity to do as you were asked!

Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

More information about the R-help mailing list