getS3method

0th

Percentile

Get an S3 Method

Get a method for an S3 generic, possibly from a namespace or the generic's registry.

Keywords
methods, data
Usage
getS3method(f, class, optional = FALSE, envir = parent.frame())
Arguments
f

character: name of the generic.

class

character: name of the class.

optional

logical: should failure to find the generic or a method be allowed?

envir

the environment in which the method and its generic are searched first.

Details

S3 methods may be hidden in namespaces, and will not then be found by get: this function can retrieve such functions, primarily for debugging purposes.

Further, S3 methods can be registered on the generic when a namespace is loaded, and the registered method will be used if none is visible (using namespace scoping rules).

It is possible that which S3 method will be used may depend on where the generic f is called from: getS3method returns the method found if f were called from the same environment.

Value

The function found, or NULL if no function is found and optional = TRUE.

See Also

methods, get, getAnywhere

Aliases
  • getS3method
Examples
library(utils) # NOT RUN { require(stats) exists("predict.ppr") # false getS3method("predict", "ppr") # }
Documentation reproduced from package utils, version 3.5.1, License: Part of R 3.5.1

Community examples

Looks like there are no examples yet.