Re: [Rd] require or import methods?

From: Prof Brian Ripley <>
Date: Sat 21 Aug 2004 - 00:59:42 EST

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,        
Professor of Applied Statistics,
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________ mailing list
Received on Sat Aug 21 01:02:19 2004

This archive was generated by hypermail 2.1.8 : Wed 03 Nov 2004 - 22:45:08 EST