From ripley at stats.ox.ac.uk  Fri Aug 20 16:59:42 2004
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Fri Aug 20 16:59:47 2004
Subject: [Rd] require or import methods?
In-Reply-To: <41260F8B.2030909@jhsph.edu>
Message-ID: <Pine.LNX.4.44.0408201555540.14043-100000@gannet.stats>

You need methods to for example call setClass.  I doubt that your R code
can be sourced without methods being on the search path.  So it needs to
go in Depends.

OTOH, you could also import the namespace to ensure that your code 
does get functions from methods and not others of the same name.  That 
might be paranoia ....

Hope that clarifies things.

On Fri, 20 Aug 2004, Roger D. Peng wrote:

> I'm developing a package now that creates some S4 classes/methods 
> (hence, uses `methods') and also has a namespace.  I'm a little confused 
> over whether I should be importing `methods' or require()-ing it.  It 
> seems to me that `methods' should be imported since it is needed for 
> setGeneric, setMethod, etc.  But, a person using my package will 
> probably want `methods' on the search path in order to use functions 
> like as() or is().  In this case, should I just require `methods' by 
> putting it in the Depends: field (for R >= 2.0.0) and not bother 
> importing the namespace?

-- 
Brian D. Ripley,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595


[Rd] require or import methods?
Prof Brian Ripley