Skip to content
Prev 26594 / 398502 Next

Writing packages with `methods' package

Take a look at the Bioconductor packages for some examples,
i.e. Biobase and affy, but others as well.

best,
-tony
roger> I'm trying to write a package which uses classes/methods as
    roger> defined in the `methods' package.  I have a single .R file
    roger> which defines the class and various methods for that class.
    roger> At the top of the file I have

    roger> require(methods)

    roger> and then

    roger> setClass("myclass", ...)  setGeneric("intersect")
    roger> setMethod("intersect", "myclass", function(x,y) ...)

    roger> I noticed that when I build the package and subsequently
    roger> load it via library(), the methods show up in the global
    roger> workspace, which is not quite what I wanted.

    roger> In general, is there any documentation on building packages
    roger> with the `methods' package (i.e. is it any different from
    roger> building packages without `methods'?) or perhaps an R-help
    roger> thread I should look for?

    roger> In short, how should I setup my package so that my methods
    roger> do not show up in the global workspace?

    roger> Thanks,

    roger> -roger _______________________________ UCLA Department of
    roger> Statistics rpeng at stat.ucla.edu
    roger> http://www.stat.ucla.edu/~rpeng

    roger> ______________________________________________
    roger> R-help at stat.math.ethz.ch mailing list
    roger> http://www.stat.math.ethz.ch/mailman/listinfo/r-help
Message-ID: <87fzsg8f2p.fsf@jeeves.blindglobe.net>
In-Reply-To: <Pine.GSO.4.10.10212291718020.2197-100000@quetelet.stat.ucla.edu> (Roger Peng's message of "Sun, 29 Dec 2002 17:27:28 -0800 (PST)")