[R] Upgrading R means I lose my packages
Prof Brian Ripley
ripley at stats.ox.ac.uk
Thu Aug 28 15:44:20 CEST 2008
On Thu, 28 Aug 2008, Michael Friendly wrote:
> James Milks wrote:
>> The title says it all. Does anyone know of a way to save your packages
>> when you upgrade to a new version of R? This may seem petty, but I'm
>> accumulating enough packages that having to download and install each of
>> them anew every time I install a new version of R is rather of a pain.
>> Ideally, I would like the new version of R to recognize the packages I've
>> installed on the previous version without needing to reinstall the
>> packages. Is that possible?
>>
>> My system: Mac OS 10.5.4.
>> Current R version: 2.7.1
>>
>> Thanks for any suggestions. My apologies if this has been answered before
>> and my search missed it.
>>
>> Jim Milks
>>
>> Degree Candidate
>>
>> ______________________________________________
>> 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.
>>
> What I find simplest (on Windows at least) is
>
> # To reinstall packages from one R version to the next:
> #Currently you can do
>
> tmp <- installed.packages()
> installedpkgs <- as.vector(tmp[is.na(tmp[,"Priority"]), 1])
> save(installedpkgs, file="c:/R/installed.rda")
>
> #in the old version to get a list of packages you installed. Then in the
> #new version,
>
> load("c:/R/installed.rda")
> install.packages(installedpkgs)
But this is an FAQ, with a cleaner answer in the rw-FAQ. It really is
much easier to make use of a separate library for the additional packages
you install (and there is no need to reinstall packages when going from
2.7.1 to 2.7.2, which helps if you have hundreds or even thousands
installed -- a complete reinstall on our 32-bit Linux server took about
5 hours when we did it for 2.7.0).
--
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