[R] ts package on CRAN ?

Martin Maechler Martin Maechler <maechler@stat.math.ethz.ch>
Fri, 8 Oct 1999 16:00:16 +0200


>>>>> "PaulG" == Paul Gilbert <pgilbert@bank-banque-canada.ca> writes:
(privately to me,
 I'm cc'ing to R-devel since this should be of a wider interest)

    MM> However, if "tseries" would just contain a
    MM> require(ts)

    PaulG> So this is how this is suppose to be done. I guess I should read
    PaulG> some documentation somewhere. 

help(library)

 (especially the last sections) should give quite a bit of info on this.

    PaulG> Should this be "in line" in the
    PaulG> library file or should it be in the .First.lib file?

There's no such thing as a ".First.lib" file; of course,
you mean the commonly used  zzz.R  file (containing the  .First.lib <- .... )

Answer: Well, it depends.. :
Usually it doesn't matter where the require() is;
Current practice 
 (grep'ing in my directory tree of all the source of all the CRAN packages)
reveals that people have adopted several different ways of doing this.

The zzz.R (which should also contain the .First.lib definition)
is good place to put such a general require().
Recently, we had a case where using
aaa.R (I think, even "Aaa.R") instead was recommended  
{Idea: aaa.R would come at the very beginning of the installed package source}

If only very little functionality of a package depends on another
(non-standard) package, I'd consider to put the  require(..)
only inside the function requiring the package, something like

  if(!require(<pkg>))
   stop("The function `...' can only be used when package <pkg> is available!")

-- 
Martin Maechler <maechler@stat.math.ethz.ch>	http://stat.ethz.ch/~maechler/
Seminar fuer Statistik, ETH-Zentrum  LEO D10	Leonhardstr. 27
ETH (Federal Inst. Technology)	8092 Zurich	SWITZERLAND
phone: x-41-1-632-3408		fax: ...-1228			<><
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel 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-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._