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? Thanks for help. --christian Dr.sc.math.Christian W. Hoffmann Mathematics and Statistical Computing Landscape Modeling and Web Applications Swiss Federal Research Institute WSL Zuercherstrasse 111 CH-8903 Birmensdorf, Switzerland phone: ++41-1-739 22 77 fax: ++41-1-739 22 15 e-mail: Hoffmann at WSL.CH www: http://www.wsl.ch/staff/christian.hoffmann/ -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
> 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 haltedas far as I know: use Aa/R/zzz.R to load A using require(A) Torsten> > Since I rather want to keep the packages separate, how can I deal with > dependences among packages? > > > Thanks for help. > --christian > > Dr.sc.math.Christian W. Hoffmann > Mathematics and Statistical Computing > Landscape Modeling and Web Applications > Swiss Federal Research Institute WSL > Zuercherstrasse 111 > CH-8903 Birmensdorf, Switzerland > phone: ++41-1-739 22 77 fax: ++41-1-739 22 15 > e-mail: Hoffmann at WSL.CH > www: http://www.wsl.ch/staff/christian.hoffmann/ > > -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- > 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 > _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._ >-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
> 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
> 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/librarythen> you do not need to set R_LIB. Typically I like to test A and Aa in a test liband> 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.(Someone> please correct me if I am wrong.) If you install A in R_HOME/library and latermake> changes to A, then a test of Aa may be comprimised by the fact that the old Ais> installed in R_HOME/library. Even with R_LIBS set, .lib.loc still appendsthe> 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 -- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._