registerS3method
Register S3 methods

Description

Register S3 methods in internal tables used for dispatching S3 generics.

Usage

registerS3method(genname, class, method, envir = parent.frame()) 
registerS3methods(info, package, env) 

Arguments

genname character string giving the generic function name.
class character string giving the class name.
method character string giving the method name or a function to be registered. If this is NA or a function, the method name is constructed from genname and class.
envir, env the environment where the S3 method(s) should be registered
info a 3-columns character matrix. Each row represents one registered S3 method. The three columns represents the generic, class and method name in turn.
package the package name where the S3 methods should be registered.

Details

registerS3method registers an S3 method in the internal table of S3 methods stored in the environment envir. Also, if envir is a namespace, the method is added to the information returned by getNamespaceInfo with which="S3methods".
registerS3methods registers multiple S3 methods specified by the matrix info. The methods are registered in the internal S3 method table for the namespace for package. The method functions are retrieved from env, and the getNamespaceInfo information is modified for the environment env if it is a namespace.
Value
registerS3method and registerS3methods returns NULL.
See Also
getNamespaceInfo, getNamespace, loadedNamespaces
Examples

## Not run: ## define dummy S3 method add1.DUMMYCLASS <- function (object, scope, ...) 123L ## register in the "stats" package registerS3method("add1","DUMMYCLASS","add1.DUMMYCLASS", envir=getNamespace("stats")) ## another way of doing the same thing registerS3methods(matrix(c("add1","DUMMYCLASS","add1.DUMMYCLASS"),nrow=1), package="stats", env=getNamespace("stats")) ## End(Not run)

Package base version 6.0.0-69
Package Index