[R] How to retrieve a method

Prof Brian Ripley ripley at stats.ox.ac.uk
Fri Dec 5 14:04:15 CET 2008


On Fri, 5 Dec 2008, Christian Hoffmann wrote:

> Hi there,
>
> I am interested in the inner workings of wilcox.test:
>
>> wilcox.test
> function (x, ...)
> UseMethod("wilcox.test")
> <environment: namespace:stats>
>
> how can I get at the code, if it is R-code? For Methods one should be able to 
> learn what extension to use, but here default or such do not help.
>
> Is there a wayplot.default to learn which different versions of "plot" there 
> are except trying plot.lm,  ...

methods("wilcox.test")
getS3method("wilcox.test", "default")

Uwe Ligges wrote an article in R-News about this in issue 6(4), although 
this particular usage (the most general for S3 methods) seems not to be 
there.

[Note for the cognescenti:  the S3 method for function foo() of class bar 
need not be foo.bar() if no such function is visible and registration was 
used.  I'm not aware of any public package that does that though.]

>
> best
>
> -c
>
> -- 
> Dr. Christian W. Hoffmann,
> Swiss Federal Research Institute WSL
> Zuercherstrasse 111, CH-8903 Birmensdorf, Switzerland Tel +41-44-7392-277 
> (office), -111(exchange), -215  (fax)
> christian.hoffmann at wsl.ch,  www.wsl.ch/personal_homepages/hoffmann/
> "Jene, die grundlegende Freiheit aufgeben wuerden, um eine geringe 
> voruebergehende Sicherheit zu erwerben, verdienen weder Freiheit noch 
> Sicherheit." - Benjamin Franklin
>
>
> -- 
> Christian W. Hoffmann,
> Rigiblickstrasse 15 b, CH-8915Hausen am Albis, Switzerland,
> Tel +41-44-7640853, c-w.hoffmann at sunrise.ch

-- 
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