The R Project SVN R

Rev

Rev 76572 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
42333 ripley 1
% File src/library/methods/man/methodUtilities.Rd
68948 ripley 2
% Part of the R package, https://www.R-project.org
76572 maechler 3
% Copyright 1995-2019 R Core Team
42333 ripley 4
% Distributed under GPL 2 or later
5
 
15430 jmc 6
\name{methodUtilities}
7
\alias{functionBody}
15822 jmc 8
\alias{functionBody<-}
15430 jmc 9
\alias{allNames}
10
\alias{getFunction}
26093 jmc 11
\alias{existsFunction}
15430 jmc 12
\alias{el}
13
\alias{elNamed}
15822 jmc 14
\alias{el<-}
15
\alias{elNamed<-}
15430 jmc 16
\alias{formalArgs}
17
\alias{Quote}
17454 jmc 18
\alias{showDefault}
21102 jmc 19
\alias{initMethodDispatch}
37018 jmc 20
\alias{methodSignatureMatrix}
15430 jmc 21
\title{Utility Functions for Methods and S-Plus Compatibility}
19029 hornik 22
\description{
70273 maechler 23
  These are \emph{internal} utilities, currently in the \pkg{methods}
24
  package, that either provide some functionality needed by the package
25
  (e.g., element matching by name), or add compatibility with S-Plus, or both.
19029 hornik 26
}
15430 jmc 27
\usage{
83769 hornik 28
functionBody(fun = sys.function(sys.parent()))
29
functionBody(fun, envir = environment(fun)) <- value
15430 jmc 30
 
31
allNames(x)
32
 
83769 hornik 33
existsFunction(f, generic = TRUE, where = topenv(parent.frame()))
34
getFunction(name, generic = TRUE, mustFind = TRUE, where)
15430 jmc 35
 
36
el(object, where)
37
 
83769 hornik 38
elNamed(x, name, mustFind = FALSE)
39
elNamed(x, name) <- value
15430 jmc 40
 
41
formalArgs(def)
42
 
70273 maechler 43
Quote(expr)
15430 jmc 44
 
20092 jmc 45
showDefault(object, oldMethods = TRUE)
21102 jmc 46
 
39491 hornik 47
initMethodDispatch(where = topenv(parent.frame()))
37018 jmc 48
 
49
methodSignatureMatrix(object, sigSlots = c("target", "defined"))
15430 jmc 50
}
17211 jmc 51
\section{Summary of Functions}{
19029 hornik 52
  \describe{
61433 ripley 53
    \item{\code{allNames}:}{
19029 hornik 54
      the character vector of names (unlike \code{names()}, never
55
      returns \code{NULL}).
56
    }
61433 ripley 57
    \item{\code{getFunction}:}{
19029 hornik 58
      find the object as a function.
59
    }
70273 maechler 60
    \item{\code{el}:}{\code{el(object, i)} is equivalent to
70332 hornik 61
      \code{object[i][[1]]} (and should typically be replaceable by object[[i]]).
70273 maechler 62
    }
61433 ripley 63
    \item{\code{elNamed}:}{
19029 hornik 64
      get the element of the vector corresponding to name.  Unlike the
70273 maechler 65
      \code{\link{[}}, \code{\link{[[}}, and \code{\link{$}} operators, this function
19029 hornik 66
      requires \code{name} to match the element name exactly (no partial
67
      matching).
68
    }
61433 ripley 69
    \item{\code{formalArgs}:}{
19029 hornik 70
      Returns the names of the formal arguments of this function.
71
    }
61433 ripley 72
    \item{\code{existsFunction}:}{
19029 hornik 73
      Is there a function of this name?  If \code{generic} is
61433 ripley 74
      \code{FALSE}, generic functions are not counted.
19029 hornik 75
    }
61433 ripley 76
    \item{\code{findFunction}:}{
19029 hornik 77
      return all the indices of the search list on which a function
61433 ripley 78
      definition for \code{name} exists.
15430 jmc 79
 
19029 hornik 80
      If \code{generic} is \code{FALSE}, ignore generic functions.
81
    }
61433 ripley 82
    \item{\code{showDefault}:}{
19029 hornik 83
      Utility, used to enable \code{show} methods to be called by the
84
      automatic printing (via \code{print.default}).
61433 ripley 85
 
76572 maechler 86
      Argument \code{oldMethods} is deprecated as it has been unused since
87
      \R >= 1.7.0.
19029 hornik 88
    }
21142 ripley 89
    \item{\code{initMethodDispatch}:}{
63624 ripley 90
      Turn on the internal method dispatch code.  Called on loading
91
      the namespace.  Also, if dispatch has been turned off (by calling
33285 hornik 92
      \code{.isMethodsDispatchOn(FALSE)}---a very gutsy thing to do),
93
      calling this function should turn dispatch back on again.
21142 ripley 94
    }
70273 maechler 95
    \item{\code{methodSignatureMatrix}:}{
48873 murdoch 96
      Returns a matrix with the contents of the specified slots as
97
      rows.  The slots should be named character strings of the same
98
      length.  Basically used to turn the signatures of a
99
      \code{"MethodDefinition"} object into a matrix for printing.
37018 jmc 100
    }
70273 maechler 101
    \item{\code{Quote}:}{is a synonym of \code{\link{quote}()} and
102
      considered deprecated.
103
    }
15430 jmc 104
  }
105
}
16802 jmc 106
\keyword{internal}