[Rd] namespace, S4 and import

Kasper Daniel Hansen khansen at stat.Berkeley.EDU
Mon Oct 15 20:43:23 CEST 2007


I have been using a bit of namespaces in the past, but the following  
alludes me.

I am dealing with the Bioconductor packages Biobase and affy. Biobase  
has a namespace and affy does not. affy contains the S4 class  
"AffyBatch" which extends the "eSet" class in Biobase.

I am extending the AffyBatch class myself. My code works fine as long  
as I do not have any NAMESPACE file.

Now I am trying to add one. I am importing Biobase, but I cannot  
import affy since it does not have a NAMESPACE. However, when I try R  
CMD INSTALL it complains that it cannot find AffyBatch :

Error in setIs(Class, class2, classDef = classDef, where = where) :
   Unable to find package environment for class "AffyBatch" to revise  
subclass information

So how do I make the classes in affy available for my package when  
affy does not have a NAMESPACE?

The relevant lines from my DESCRIPTION file is
   Depends: R (>= 2.6), affy (>= 1.16), affxparser (>= 1.10),  
Biobase, methods
   LazyLoad: yes

and from my NAMESPACE file I have

I have also tried (in desperation) to add a "require(affy)" in  
both .onLoad and .onAttach, but to no help.

While I am at this: as I remember it, in the old days we needed  
"require(methods)" in .onLoad to work with S4, is that still necessary?

I am using R-2.6.0 on OS X (PPC)

Thanks, Kasper

More information about the R-devel mailing list