[R] mac question

Steve Lianoglou mailinglist.honeypot at gmail.com
Tue Nov 3 16:14:00 CET 2009


Hi,

On Nov 3, 2009, at 2:41 AM, Antje wrote:

> Hi there,
>
> currently, I've updated R on my Mac (OS X) to version 2.10. I was  
> wondering if I have to install all additional packages again???
> In Windows, I just needed to copy the library folder of the old  
> installation but how does it work with Mac?

This isn't really a mac or windows thing, actually. Although this  
method may have worked for you in the past, it's generally not  
recommended to use libraries compiled from one R version in another.  
Using the same libraries between 2.9.X to 2.9.X+n is fine, but doing  
the same when going from 2.9 to 2.10 is not a good idea.

So, in short, you should updated/reinstall your packages now that  
you've updated R.

An easy way to do that would have been to save a file of all packages  
installed from 2.9, then use that file to reinstall those packages  
from within 2.10. Here's a recipe to do that now (assuming R 2.9 is  
still installed on your system).

You can use RSwitch to switch which version of R is "active" at a  
time, available here:
http://r.research.att.com/RSwitch-1.1.dmg

1. Fire up RSwitch and pick R 2.9
1.5. I have these two functions I use when I want to be lazy:

installedPackages <- function(to="~/R.packages.dump.txt") {
   writeLines(installed.packages()[,1], con=to)
}

reloadPackages <- function(from="~/R.packages.dump.txt") {
   source("http://bioconductor.org/biocLite.R")
   packages <- readLines(from)
   biocLite(packages)
}

2. Call installedPackages() from within R 2.9 and quit
3. Use rswitch to make R 2.10 active
4. Open R 2.10 and run reloadPackages()

biocLite is a function to install bioconductor packages, but it also  
installs "normal" cran packages. You can likely replace the call to  
biocLite with a call to install.packages(packages) if you don't have  
any bioc packages to install, if you like, although it shouldn't be  
necessary.

It might take a while to d/l all your packages again, but it should  
"just work"

-steve

--
Steve Lianoglou
Graduate Student: Computational Systems Biology
   |  Memorial Sloan-Kettering Cancer Center
   |  Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact




More information about the R-help mailing list