[Bioc-devel] BiocGenerics / NAMESPACE question

Hervé Pagès hpages at fhcrc.org
Mon Dec 5 20:00:52 CET 2011

Hi Kapser,

On 11-12-04 10:40 AM, Kasper Daniel Hansen wrote:
> I have looked a bit at BiocGenerics.  I may not be up to date on the
> latest in export/NAMESPACE, but why are (almost) all the generics
> exported as
>    export(lapply)
> and not
>    exportMethod(lapply)
> and why is combine/updateObject different.  Is it because you need
> export() to register the generic and only exportMethod if the package
> defines a method aside from the generic?

Yep. export() is for a function (a generic is a function),
exportMethod() is for a method. There is no "lapply" method defined
in BiocGenerics, just the "lapply" generic function.

> And does that mean I need to
> treat exporting a method differently depending on whether or not the
> package I am writing defines the generic or not?

If the package you are writing defines a method for a generic that is
defined elsewhere, then you need to import the generic and to export
only the method. If your package defines the generic and at least one
method for it, then you don't need to import anything (besides the
method package of course) and you need to export the generic (with
export()) and the method (with exportMethod()).


>> From the additions to minfi's NAMESPACE it also seems like I have to
> get the generic by importFrom and not importMethodsFrom.
> There is probably something I don't get, but I am a bit surprised.
> Kasper
> _______________________________________________
> Bioc-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/bioc-devel

Hervé Pagès

Program in Computational Biology
Division of Public Health Sciences
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N, M1-B514
P.O. Box 19024
Seattle, WA 98109-1024

E-mail: hpages at fhcrc.org
Phone:  (206) 667-5791
Fax:    (206) 667-1319

More information about the Bioc-devel mailing list