[BioC] .First.lib <- function(libname, pkgname, where) {

Gordon Smyth smyth@wehi.edu.au
Tue, 18 Feb 2003 21:03:28 +1100

Dear Laurent,

Thanks for your tip to look at zzz.R in Biobase. Here's a piece of code 
that occurs in zzz.R for Biobase and for many of the other bioconductor 

.First.lib <- function(libname, pkgname, where) {
     require(methods, quietly=TRUE)
     where <- match(paste("package:", pkgname, sep=""), search())

I think that I'm starting to understand this, but just to make sure ... the 
"where" in the first line "function(libname, pkgname, where)" really is 
superfluous, an unused argument. Right? The code would work just as well as

.First.lib <- function(libname, pkgname) {
     require(methods, quietly=TRUE)
     where <- match(paste("package:", pkgname, sep=""), search())

Or is there something really, really, mysterious going on?


At 04:41 PM 18/02/2003, Laurent Gautier wrote:
>On Tue, Feb 18, 2003 at 12:16:02AM -0500, Robert Gentleman wrote:
> > On Tue, Feb 18, 2003 at 04:08:51PM +1100, Gordon Smyth wrote:
> > > Dear all,
> > >
> > > I am trying to package up some microarray data analysis code into a
> > > bioconductor package and, naturally, I want to define some new generic
> > > functions using the methods library. I have not been able to get my 
> package
> > > to pass rcmd check.  In particular, generic functions which I have 
> defined
> > > are not recognized when rcmd check tries out the examples.  However, all
> > > the examples work correctly if I actually build the library using rcmd
> > > build, then install it and load it in my R session using library.  The
> > > examples then work correctly if I paste them into my R session.
>Looks like a variant of "forget 'where=where'". As Robert said, pick
>one package in bioC (say Biobase). .First.lib is
>defined in a file called zzz.R (seems to be a tacit convention to call
>files that do that this way in packages). Forgeting the argument 'where'
>when defining a S4-style method is something I remember doing quite few
>times in the begining (and it made R check not so happy while the stuff
>was working when doing copy/paste).
>Hopin' it helps,