Rev 78769 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
% File src/library/utils/man/getS3method.Rd% Part of the R package, https://www.R-project.org% Copyright 1995-2015 R Core Team% Distributed under GPL 2 or later\name{getS3method}\alias{getS3method}\title{Get an S3 Method}\description{Get a method for an S3 generic, possibly from a namespace or thegeneric's registry.}\usage{getS3method(f, class, optional = FALSE, envir = parent.frame())}\arguments{\item{f}{a character string giving the name of the generic.}\item{class}{a character string giving the name of the class.}\item{optional}{logical: should failure to find the generic or amethod be allowed?}\item{envir}{the \code{\link{environment}} in which the method and itsgeneric are searched first.}}\details{S3 methods may be hidden in namespaces, and will notthen be found by \code{\link{get}}: this function can retrievesuch functions, primarily for debugging purposes.Further, S3 methods can be registered on the generic when a namespaceis 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 wherethe generic \code{f} is called from: \code{getS3method} returns themethod found if \code{f} were called from the same environment.}\value{The function found, or \code{NULL} if no function is found and\code{optional = TRUE}.}\seealso{\code{\link{methods}}, \code{\link{get}}, \code{\link{getAnywhere}}}\examples{require(stats)exists("predict.ppr") # falsegetS3method("predict", "ppr")}\keyword{data}\keyword{methods}