[R]package dependence

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Feb 15 17:11:23 CET 2001

> Date: Thu, 15 Feb 2001 10:56:27 -0500
> From: Paul Gilbert <pgilbert at bank-banque-canada.ca>
> > I want to create several packages, with package Aa depending on functions
> > in package A.
> As Brian pointed out, your .First.lib for package Aa should have a statement
> require(A), and also for  R CMD check  you need to install A in lib and set
> R_LIBS=lib. I think if you check A first and then install it in R_HOME/library 
> you do not need to set R_LIB. Typically I like to test A and Aa in a test lib 
> make sure they are both working before installing in R_HOME/library.

If you install in R_HOME/library then you do not need to set R_LIBS.
However, you may either not be allowed to install there, or choose not to.
(No mere user here has install rights in R_HOME/library.)

> There is a  problem to be careful about when you are in development mode. 
> please correct me if I am wrong.) If you install A in R_HOME/library and later 
> changes to A, then a test of Aa may be comprimised by the fact that the old A 
> installed in R_HOME/library. Even with R_LIBS  set,   .lib.loc still appends 
> default library  in R_HOME.

The test of Aa will always use the installed version of A it finds first
in R_LIBS:R_HOME/library.  Only the test of A will use the sources of A.
So you need to make sure your current versions are installed.

I very rarely install in R_HOME/library.  For several reasons:

(1) As myself I have no rights to do so either in the dept nor on my own
machines. (R is owned by a separate account.)
(2) It makes changing versions of R very much easier.
(3) It is easy to exclude ones own libraries when it is convenient,
e.g. by --vanilla.


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 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list