[R] Discovering methods

Prof Brian Ripley ripley at stats.ox.ac.uk
Mon Dec 1 08:37:15 CET 2003


On Sun, 30 Nov 2003, Thomas Lumley wrote:

> On Fri, 28 Nov 2003, Gabor Grothendieck wrote:
>
> > Sure, but why are some methods found using methods("POSIXct")
> > while other methods not found?
> >
> > It would be nice to have some reliable documentation-independent
> > way to discover all the methods for a class.
> 
> Indeed it would, but that requires registration of methods using either
> the S4 approach or the functions for handling S3 methods in namespaces.
> 
> Without this, it is simply not possible to decide, for example, whether
> t.test.formula is a method for t() or for t.test() or a separate function.

It also needs registration of generics.  No one thought to list the 
members of the group generics (such as "+") as individual generics until 
recently, and methods() does try to find a corresponding generic to at 
least find out if t() and t.test() are generic functions.

methods() is R-devel does a better job -- even that in R-patched does a 
better job now a couple of long-standing bugs in find() have been fixed.

-- 
Brian D. Ripley,                  ripley at 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




More information about the R-help mailing list