From simon.urbanek at r-project.org  Thu Nov 30 16:39:33 2006
From: simon.urbanek at r-project.org (Simon Urbanek)
Date: Thu, 30 Nov 2006 10:39:33 -0500
Subject: [Rd] use one custom package with multiple R versions?
In-Reply-To: <20061130134813.GA64449@tehun.pair.com>
References: <20061130134813.GA64449@tehun.pair.com>
Message-ID: <DEE32506-2845-48F0-B56A-0DBF320185AB@r-project.org>


On Nov 30, 2006, at 8:48 AM, Andrew Piskorski wrote:

> I'd like to install several different versions of R from source.   
> I'm doing this on Ubuntu Linux 6.06 Dapper x86-64, which ships with  
> R 2.2.1, so the versions of R I want to use are (for now) 2.2.1,  
> 2.4.x, and the development head.
>
> Fetching the sources with Subversion and running configure with  
> something like "--prefix=/usr/local/R-2.4-branch-20061130" is  
> straightforward, but are there any other best practices I should be  
> aware of for using multiple R installs?
>

Personally, I prefer using default prefix (i.e. the equivalent to -- 
prefix=/usr/local) and then use
make install rhome=/usr/local/R/2.4
The advantage of this is that it will behave as if it was installed  
in the regular prefix and thus handling things like external  
libraries is much less painful. Just make sure you create proper  
symlinks for starting such beasts, because the start script in /usr/ 
local/bin will be overwritten on each install (but the 'real'  one is  
in $rhome/bin anyway).

Note, however, that you don't need to install R in order to use it,  
so many people just run it from the build directory and don't bother  
running make install at all.


> In particular, I wonder how to best handle my custom R packages,  
> some of which contain compiled C or Fortran.  Is it safe to use  
> only ONE copy of each of my packages for all versions of R, or do I  
> need a separate version of each package for each R version?
>

For each R version you should be using separate packages. In practice  
packages sometimes work across versions (patch versions are usually  
safe, minor versions are safe only sometimes - it is still not  
recommended). When working with snapshots, you can usually use the  
same set of packages and re-compile only if things go wrong.


> If I do need a separate package per version of R, is it possible  
> (and advisable?) to manage that from a single source tree, or am I  
> forced to have multiple source working copies?
>

You can always use same source tree - that's not the problem. The  
main reason for keeping separate installations (of the same) packages  
is binary compatibility which is not guaranteed across versions.  
Packages without Fortran/C code can be often shared across versions -  
i.e. you can set R_LIBS such that you have version-specific directory  
first and a common directory second.


> (I see that R CMD INSTALL has a "--with-package-versions" option,  
> but I think that's about using multiple versions of a package with  
> one version of R, while I want the vice versa.)
>

Yes, that's the case.

Cheers,
Simon



[Rd] use one custom package with multiple R versions?
Simon Urbanek