[R]package dependence

Paul Gilbert pgilbert at bank-banque-canada.ca
Thu Feb 15 16:56:27 CET 2001

> 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 then
you do not need to set R_LIB. Typically I like to test A and Aa in a test lib and
make sure they are both working before installing in R_HOME/library.

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

If you only have the packages A and Aa then you can probably manage these
dependencies without too much difficulty. If you have a more complicated set of
dependencies then I have a Makefile which I am willing to share (and perhaps there is
enough other interest to develop this into a generic model). My situation is: I have
three bundles A, B, and C. Bundle A has packages a1, a2, a3, a4. Bundle B has
packages b1, b2, b3. Bundle C has packages c1, c2, c3. Package a4 depends on a3 which
depends on a2 which depends on a1. Packages in bundles B and C all depend on a3. I
don't think I have things set up in the best possible way yet, but my makefile (when
things are working correctly)  lets me test these all in both R and Splus.

Paul Gilbert

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