genericFunction-class {methods}R Documentation

Generic Function Objects


Generic functions (objects from or extending class genericFunction) are extended function objects, containing information used in creating and dispatching methods for this function. They also identify the package associated with the function and its methods.

Objects from the Class

Generic functions are created and assigned by setGeneric or setGroupGeneric and, indirectly, by setMethod.

As you might expect setGeneric and setGroupGeneric create objects of class "genericFunction" and "groupGenericFunction" respectively.


Object of class "function", the function definition of the generic, usually created automatically as a call to standardGeneric.
Object of class "character", the name of the generic function.
Object of class "character", the name of the package to which the function definition belongs (and not necessarily where the generic function is stored). If the package is not specified explicitly in the call to setGeneric, it is usually the package on which the corresponding non-generic function exists.
Object of class "list", the group or groups to which this generic function belongs. Empty by default.
Object of class "character"; if not an empty character vector, identifies one or more classes. It is asserted that all methods for this function return objects from these class (or from classes that extend them).
Object of class "character", the vector of formal argument names that can appear in the signature of methods for this generic function. By default, it is all the formal arguments, except for .... Order matters for efficiency: the most commonly used arguments in specifying methods should come first.
Object of class "OptionalMethods", the default method for this function. Generated automatically and used to initialize method dispatch.
Object of class "call", a slot used internally in method dispatch. Don't expect to use it directly.


Class "function", from data part.
Class "OptionalMethods", by class "function".
Class "PossibleMethod", by class "function".


Generic function objects are used in the creation and dispatch of formal methods; information from the object is used to create methods list objects and to merge or update the existing methods for this generic.

[Package methods version 2.5.0 Index]