methodUtilities {methods} | R Documentation |
Utility Functions for Methods and S-Plus Compatibility
Description
These are internal utilities, currently in the methods package, that either provide some functionality needed by the package (e.g., element matching by name), or add compatibility with S-Plus, or both.
Usage
functionBody(fun = sys.function(sys.parent()))
functionBody(fun, envir = environment(fun)) <- value
allNames(x)
existsFunction(f, generic = TRUE, where = topenv(parent.frame()))
getFunction(name, generic = TRUE, mustFind = TRUE, where)
el(object, where)
elNamed(x, name, mustFind = FALSE)
elNamed(x, name) <- value
formalArgs(def)
Quote(expr)
showDefault(object, oldMethods = TRUE)
initMethodDispatch(where = topenv(parent.frame()))
methodSignatureMatrix(object, sigSlots = c("target", "defined"))
Summary of Functions
allNames
:-
the character vector of names (unlike
names()
, never returnsNULL
). getFunction
:-
find the object as a function.
el
:el(object, i)
is equivalent toobject[i][[1]]
(and should typically be replaceable by object[[i]]).elNamed
:-
get the element of the vector corresponding to name. Unlike the
[
,[[
, and$
operators, this function requiresname
to match the element name exactly (no partial matching). formalArgs
:-
Returns the names of the formal arguments of this function.
existsFunction
:-
Is there a function of this name? If
generic
isFALSE
, generic functions are not counted. findFunction
:-
return all the indices of the search list on which a function definition for
name
exists.If
generic
isFALSE
, ignore generic functions. showDefault
:-
Utility, used to enable
show
methods to be called by the automatic printing (viaprint.default
).Argument
oldMethods
is deprecated as it has been unused since R >= 1.7.0. initMethodDispatch
:-
Turn on the internal method dispatch code. Called on loading the namespace. Also, if dispatch has been turned off (by calling
.isMethodsDispatchOn(FALSE)
—a very gutsy thing to do), calling this function should turn dispatch back on again. methodSignatureMatrix
:-
Returns a matrix with the contents of the specified slots as rows. The slots should be named character strings of the same length. Basically used to turn the signatures of a
"MethodDefinition"
object into a matrix for printing. Quote
:is a synonym of
quote()
and considered deprecated.