The R Project SVN R

Rev

Rev 58472 | Rev 68948 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
42333 ripley 1
% File src/library/utils/man/getS3method.Rd
2
% Part of the R package, http://www.R-project.org
59039 ripley 3
% Copyright 1995-2012 R Core Team
42333 ripley 4
% Distributed under GPL 2 or later
5
 
27442 ripley 6
\name{getS3method}
56186 murdoch 7
\alias{getS3method}
27442 ripley 8
\title{Get An S3 Method}
9
\description{
58472 ripley 10
  Get a method for an S3 generic, possibly from a namespace or the
11
  generic's registry.
27442 ripley 12
}
13
\usage{
14
getS3method(f, class, optional = FALSE)
15
}
16
\arguments{
17
  \item{f}{character: name of the generic.}
18
  \item{class}{character: name of the class.}
19
  \item{optional}{logical: should failure to find the generic or a
20
    method be allowed?}
21
}
22
\details{
58472 ripley 23
  S3 methods may be hidden in namespaces, and will not
27442 ripley 24
  then be found by \code{\link{get}}: this function can retrieve
25
  such functions, primarily for debugging purposes.
58472 ripley 26
 
27
  Further, S3 methods can be registered on the generic when a namespace
28
  is loaded, and the registered method will be used if none is visible
29
  (using namespace scoping rules).
30
 
31
  It is possible that which S3 method will be used may depend on where
32
  the generic \code{f} is called from: \code{getS3method} returns the
33
  method found if \code{f} were called from the same environment.
27442 ripley 34
}
35
\value{
36
  The function found, or \code{NULL} if no function is found and
37
  \code{optional = TRUE}.
38
}
39
\seealso{
58472 ripley 40
  \code{\link{methods}}, \code{\link{get}}, \code{\link{getAnywhere}}
27442 ripley 41
}
42
\examples{
27464 ripley 43
require(stats)
27442 ripley 44
exists("predict.ppr") # false
45
getS3method("predict", "ppr")
46
}
47
\keyword{data}
48