[Rd] Help for methods

hadley wickham h.wickham at gmail.com
Mon Sep 18 17:24:27 CEST 2006


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




More information about the R-devel mailing list