[Rd] Help for methods

Hin-Tak Leung hin-tak.leung at cimr.cam.ac.uk
Tue Sep 19 14:25:07 CEST 2006


You are supposed to do:

?summary.lm
?summary.data.frame

for S3 methods. The former works, the latter doesn't - which is
probably considered a bug, but then the usage of some of the
generics are probably considered obvious and fundamental enough
that summary.data.frame doesn't really behave in any substantially
different way compared to what is said in ?summary and ?Summary .

hadley wickham wrote:
> Help for help says:
> 
> The 'topic' argument may also be a function call, to ask for
>           documentation on a corresponding method.  See the section on
>           method documentation.
> 
> and
> 
>      The authors of formal ('S4') methods can provide documentation on
>      specific methods, as well as overall documentation on the methods
>      of a particular function.  The '"?"' operator allows access to
>      this documentation in three ways.
> 
> ...
> 
>      There are two different ways to look for documentation on a
>      particular method.  The first is to supply the 'topic' argument in
>      the form of a function call, omitting the 'type' argument. The
>      effect is to look for documentation on the method that would be
>      used if this function call were actually evaluated. See the
>      examples below.  If the function is not a generic (no S4 methods
>      are defined for it), the help reverts to documentation on the
>      function name.
> 
> Which doesn't explicitly mention whether this will work for S3 either
> way, but the results from:
> 
> ?summary
> ?summary(lm(wt ~ mpg, data=mtcars)
> ?summary(data.frame())
> 
> seem to indicate that it doesn't (at least in my R2.3.0, which is out
> of date, but I did also search the latest NEWS file for anthing
> mentioning help).  Would it be possible to extend this method to deal
> with S3 classes as well?
> 
> Hadley
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel




More information about the R-devel mailing list