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
On 28/08/2008, at 2:02 PM, 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.1Mac OS moves in mysterious ways, but apparently your installation moves in more mysterious ways than most. I also (by necessity, not by choice) run Mac OS. But I certainly don't lose my packages when I update R. The new version of R certainly ``recognizes'' the packages that I have installed. No action required. There may be something funny about *where* you have your packages installed, and what environment variables you have set. To answer your question ``Is that possible?'' --- Yes. Not just possible, but universal. Except, it would seem, in your case. What have you done to offend the gods? :-) cheers, Rolf Turner ###################################################################### Attention:\ This e-mail message is privileged and confid...{{dropped:9}}
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) -- Michael Friendly Email: friendly AT yorku DOT ca Professor, Psychology Dept. York University Voice: 416 736-5115 x66249 Fax: 416 736-5814 4700 Keele Street http://www.math.yorku.ca/SCS/friendly.html Toronto, ONT M3J 1P3 CANADA
Speaking for myself, I think it's easier to just create a script and put it somewhere easy to remember. For example my.pkgs <- c('pkg1', 'pkg2') ## and so on for my preferred packages install.packages(my.pkgs, dependencies=TRUE) Then after each upgrade just source the script. You will need to create a second list if you use any packages for which binaries are not available. Creating the list the first time might be inconvenient .... but thereafter it's easy. Additional benefits include you can use the script when you get a new machine you can use the script when a friend or colleague decides to try R, and you want them to have the same packages you can use the script if you maintain R on more than one platform, as I do A downside would be if you have a huge number of packages and it takes a long time to update them all. But even then, since most packages are available as binaries, it should be reasonable. Installing a huge number from source will take a long time. This method is also a little tricky if you have locally written packages. -Don At 10:02 PM -0400 8/27/08, 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.-- -------------------------------------- Don MacQueen Environmental Protection Department Lawrence Livermore National Laboratory Livermore, CA, USA 925-423-1062