[Rd] initialization of S4 classes/methods

John Chambers jmc at research.bell-labs.com
Mon Oct 27 21:21:33 MET 2003


"A.J. Rossini" wrote:
> 
> I'm seeing weird issues in methods initialization, i.e. loading
> marrayClasses loads Biobase, and when explicitly done, as in
> 
>    library(Biobase)
>    library(marrayClasses)
> 
> is fine, but when Biobase is loaded via a require statement in
> marrayClasses' .First.Lib, I end up with:
> 
>   Warning message: In the method signature for function "coerce", class
>   "exprSet" has no current definition in: matchSignature(signature,
>   fdef, where)

Yes.  See below.  Does this actually cause problems later on?  When
methods are dispatched, it's likely that "exprSet" will be found.

> 
> and based on the "band-aid" working above, suggests an initialization
> or evaluation timing problem.

Not exactly.  The problem is one of the behavior of require() combined
with rules for parents of environments; it's bitten us before, but so
far hasn't been fixed.

1.  The effect of require() is to put Biobase on the search path
_before_ marrayClasses, whereas in the case that library(Biobase) has
been done previously, the opposite is true.

2.  In looking for the definiton of class exprSet, the call to exists
from setMethod will start with the environment of package marrayClasses
and search through the chain of parent environments; i.e., all the
packages _after_ marrayClasses in the search list.  And so it doesn't
find class "exprSet".

It's possible to hack our way around point 2 (by having a special case
for the environment not being a namespace), but point 1 seems not quite
correct.  For example, if the owner of marrayClasses wanted to
deliberately override an object in Biobase, require() would prevent it. 
(Not that overriding is necessarily a good practice, but it should
either work or be an error.)
 
John
> 
> (and exprSet is defined in the Biobase package).
> 
> best,
> -tony
> 
> --
> rossini at u.washington.edu            http://www.analytics.washington.edu/
> Biomedical and Health Informatics   University of Washington
> Biostatistics, SCHARP/HVTN          Fred Hutchinson Cancer Research Center
> UW (Tu/Th/F): 206-616-7630 FAX=206-543-3461 | Voicemail is unreliable
> FHCRC  (M/W): 206-667-7025 FAX=206-667-4812 | use Email
> 
> CONFIDENTIALITY NOTICE: This e-mail message and any attachme...{{dropped}}
> 
> ______________________________________________
> R-devel at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-devel

-- 
John M. Chambers                  jmc at bell-labs.com
Bell Labs, Lucent Technologies    office: (908)582-2681
700 Mountain Avenue, Room 2C-282  fax:    (908)582-3340
Murray Hill, NJ  07974            web: http://www.cs.bell-labs.com/~jmc



More information about the R-devel mailing list