Skip to content
Back to formatted view

Raw Message

Message-ID: <Pine.GSO.4.10.10212291718020.2197-100000@quetelet.stat.ucla.edu>
Date: 2002-12-30T02:31:02Z
From: Roger D. Peng
Subject: Writing packages with `methods' package

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

require(methods)

and then 

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

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

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

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

Thanks,

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