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.
The expression methods?f
will look for the overall
documentation methods for the function f
. Currently,
this means the documentation file containing the alias
f-methods
.
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.
The "?"
operator can also be called with doc_type
supplied
as method
; in this case also, the topic
argument is
a function call, but the arguments are now interpreted as specifying
the class of the argument, not the actual expression that will
appear in a real call to the function. See the examples below.
The first approach will be tedious if the actual call involves
complicated expressions, and may be slow if the arguments take a
long time to evaluate. The second approach avoids these
issues, but you do have to know what the classes of the actual
arguments will be when they are evaluated.
Both approaches make use of any inherited methods; the signature of
the method to be looked up is found by using selectMethod
(see the documentation for getMethod
). A limitation
is that methods in packages (as opposed to regular functions) will only
be found if the package exporting them is on the search list, even
if it is specified explicitly using the ?package::generic()
notation.