
Last chance! 50% off unlimited learning
Sale ends in
methods(generic.function, class)
generic.function
is not supplied."MethodsFunction"
, a
character vector of function names with an "info"
attribute.
There is a print
method which marks with an asterisk any
methods which are not visible: such functions can be examined by
getS3method
or getAnywhere
.The "info"
attribute is a data frame, currently with a
logical column, visible
and a factor column from
(indicating where the methods were found).
methods
can be used to find out about the methods for
a particular generic function or class. The functions listed are those
which are named like methods and may not actually be methods
(known exceptions are discarded in the code). Note that the listed
methods may not be user-visible objects, but often help will be
available for them. If class
is used, we check that a matching generic can be found
for each user-visible object named. If generic.function
is
given, there is a warning if it appears not to be a generic function.
(The check for being generic used can be fooled.)
S3Methods
, class
, getS3method
. For S4, showMethods
, Methods
.
require(stats)
methods(summary)
methods(class = "aov")
methods("[[") # uses C-internal dispatching
methods("$")
methods("$<-") # replacement function
methods("+") # binary operator
methods("Math") # group generic
require(graphics)
methods("axis") # looks like it has methods, but not generic
## Not run:
# methods(print) # over 100
# ## End(Not run)
## --> help(showMethods) for related examples
Run the code above in your browser using DataLab