[R] expressing functions

Prof Brian Ripley ripley at stats.ox.ac.uk
Wed Dec 10 05:34:05 CET 2003


On Tue, 9 Dec 2003, Remington, Richard wrote:

> # Why does expressing one function
> 
> require(ctest)
> t.test
> 
> # return only
> 
> function (x, ...)
> UseMethod("t.test")
> <environment: namespace:ctest>
> 
> # but expressing another function
> 
> shapiro.test
> 
> # returns more complete code?
[...]

False hypothesis: both are the complete code.

You are not understanding (S3-style) generic functions: see any good book
on R/S.

(`An Introduction to R' is based on notes that predate them, but they are
covered in more detail in the draft R Language manual.  `The reader is
referred to the official references for a complete discussion of this
mechanism.' which I think means Chambers & Hastie, 1992,)

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