List Methods for S3 Generic Functions or Classes
List all available methods for an S3 generic function, or all methods for a class.
- a generic function, or a character string naming a generic function.
- a symbol or character string naming a class: only used if
generic.functionis not supplied.
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.
class is used, we check that a matching generic can be found
for each user-visible object named. If
given, there is a warning if it appears not to be a generic function.
(The check for being generic used can be fooled.)
An object of class
"MethodsFunction", a character vector of function names with an
"info"attribute. There is a
"info"attribute is a data frame, currently with a logical column,
visibleand a factor column
from(indicating where the methods were found).
This scheme is called S3 (S version 3). For new projects,
it is recommended to use the more flexible and robust S4 scheme
provided in the methods package. Functions can have both S3
and S4 methods, and function
list the S4 methods (possibly none).
methods function was written by Martin Maechler.
Chambers, J. M. (1992) Classes and methods: object-oriented programming in S. Appendix A of Statistical Models in S eds J. M. Chambers and T. J. Hastie, Wadsworth & Brooks/Cole.
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