[R]package dependence

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Feb 15 10:02:13 CET 2001


On Thu, 15 Feb 2001, Christian Hoffmann wrote:

> Hi,
>
> I want to create several packages, with package Aa depending on functions
> in package A. My directories with .r and .Rd are organized as follows
>
> ./A/man/*.Rd
> ./A/R/*.r
> ./Aa/man/*.Rd
> ./Aa/R/*.r
>
> Afre creatin package A with
>
> R CMD check A
> R CMD INSTALL --library=lib A
>
> I then have
> ./lib/A/help  etc
>
> If I try to do
>
> R CMD check Aa
> R CMD INSTALL --library=lib Aa
>
> I am getting
>
> * checking examples ... ERROR
> and in ./Aa.Rcheck/Aa-Ex.Rout
>
> there is the error signalled
>
> 	couldn't find function "function.from.A"
> Execution halted
>
> Since I rather want to keep the packages separate, how can I deal with
> dependences among packages?

Does the function .First.lib in package Aa contain `require(A)'?  That is
how this is done.  (You can also put it in any of the code files of
package Aa, but it seems cleaner to use .First.lib.)

To use this with R CMD check you need to ensure that `lib' is used as a
library directory. As R CMD check uses --vanilla, you will need to set
R_LIBS=lib, in the calling environment as .Rprofile and .Renviron are
skipped.

-- 
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