[R] Keeping package sources for recompilation with new R version?

Uwe Ligges ligges at statistik.tu-dortmund.de
Sun Oct 25 19:42:49 CET 2009

Rainer M Krug wrote:
> Hi
> I am using Ubuntu Hardy, and I installing many packages from source. I am
> keeping my R packages fairly up to date.
> My question is: is there a way, of keeping the source packages, so that when
> I am installing a new version of R, an update.packages(checkBuilt=TRUE) will
> only fetch the packages when newer ones are available, but otherwise will
> use the local copies?
> To rephrase it, is it possible to have some kind of local repository for the
> source packages which are installed, so that only packages are downloaded
> when newer ones are available? I could use destdir to specify the directory
> in which to save the source files of the packages, but how can I use this
> directory as a first choice, and only download if a newer version exists?
> Rainer

I think it won't work out of the box, but you can do it with little 
efforts. The probably easiest way is to

1) make the local directory of source packages a repository by adding a 
PACKAGES file using write_PACKAGES() from package tools,
2) choose your local repository first on the list of repositories and 
second a repository on a CRAN and/or BioC mirror etc.,
3) use update.packages() and it will grab from your first repository if 
there is no repository with a newer version number.

Uwe Ligges

More information about the R-help mailing list