Search by name for an object (
get) or zero or more objects
1 2 3 4 5 6 7
where to look for the object (see ‘Details’); if omitted search as if the name of the object appeared unquoted in an expression.
the mode or type of object sought: see the ‘Details’ section.
should the enclosing frames of the environment be searched?
integer specifying the minimal frame number to look into.
pos argument can specify the environment in which to look
for the object in any of several ways: as a positive integer (the
position in the
search list); as the character string
name of an element in the search list; or as an
environment (including using
to access the currently active function calls). The default of
-1 indicates the current environment of the call to
envir argument is an alternative way to
specify an environment.
These functions look to see if each of the name(s)
x have a
value bound to it in the specified environment. If
TRUE and a value is not found for
x in the specified
environment, the enclosing frames of the environment are searched
until the name
x is encountered. See
and the ‘R Language Definition’ manual for details about the
structure of environments and their enclosures.
mode is specified then only objects of that type are sought.
mode here is a mixture of the meanings of
"function" covers primitive functions
all refer to any numeric type,
"language" must be used (and not
mget, the values of
be either the same length as
x or of length 1. The argument
ifnotfound must be a list containing either the value to use if
the requested item is not found or a function of one argument which
will be called if the item is not found, with argument the name of the
item being requested.
dynGet() is somewhat experimental and to be used inside
another function. It looks for an object in the callers, i.e.,
sys.frame()s of the function. Use with caution.
get, the object found. If no object is found an error results.
mget, a named list of objects (found or specified via
The reverse (or “inverse”) of
a <- get(nam) is
assign(nam, a), assigning
a to name
inherits = TRUE is the default for
get in R
but not for S where it had a different meaning.
Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New S Language. Wadsworth & Brooks/Cole.
exists for checking whether an object exists;
get0 for an efficient way of both checking existence and
getting an object.
assign, the inverse of
get(), see above.
getAnywhere for searching for an object
anywhere, including in other namespaces, and
getFromNamespace to find an object in a specific
1 2 3 4 5
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.