selectMethod
Get a Method for a Generic Function

Description

Returns the method that S would use to evaluate a call to a generic function with a given signature. This might be defined explicitly for this signature or inferred by class extensions. Contrast this method with getMethod, which works only on methods actually defined for this specific function and signature, not using any class extensions.

Usage

selectMethod(f, signature, optional = FALSE, useInherited = TRUE, 
             mlist = if (!is.null(fdef)) getMethodsForDispatch(fdef), 
             fdef = getGeneric(f, !optional, where=topenv(parent.frame())),
             verbose = FALSE, doCache = FALSE) 

Arguments

f a character string. The name of the generic function.
signature a string vector. The signature of the method to return.
optional a logical flag. If TRUE, selectMethod returns NULL instead of an error message if no method is found. The default is FALSE.
useInherited a logical vector, replicated to the length of signature. If an element is TRUE (the default), the corresponding signature argument can be matched by an inherited class. If an element is FALSE, the corresponding signature argument must exactly match the selected method.
mlist this argument is unimplemented, and a warning is generated if it is given.
fdef a generic function object examined to find the specified method. If this is not given, a generic function with the name specified by f is found.
verbose this argument is unimplemented, and a warning is generated if it is given.
doCache this argument is unimplemented, and a warning is generated if it is given.

Details

This function searches only for S4 methods: that is, those defined using setMethod. You can find "Old-style" S3 methods using methods.
Value
returns a function definition. If no method is found, selectMethod generates an error message, or if optional is TRUE, returns NULL.
See Also
setMethod, methods
Examples
selectMethod("show", "classRepresentation")
Package methods version 6.0.0-69
Package Index