This help topic is for R version 1.5.0. For the current version of R, try https://stat.ethz.ch/R-manual/R-patched/library/base/html/get.html
get {base}R Documentation

Return a Variable's Value

Description

Search for an R object with a given name and return it if found.

Usage

get(x, pos=-1, envir=as.environment(pos), mode="any", inherits=TRUE)

Arguments

x

a variable name (given as a quoted character string).

pos

where to look for the object (see the details section); if omitted, the function will search, as if the name of the object appeared in unquoted in an expression.

envir

an alternative way to specify an environment to look in; see the details section.

mode

the mode of object sought.

inherits

should the enclosing frames of the environment be inspected?

Details

The pos argument can specify the environment in which to look for the object in any of several ways: as an 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 sys.frame to access the currently active function calls). The envir argument is an alternative way to specify an environment, but is primarily there for back compatibility.

The mode includes collections such as "numeric" and "function": any member of the collection will suffice.

Value

This function searches the specified environment for a bound variable whose name is given by the character string x. If the variable's value is not of the correct mode, it is ignored.

If inherits is FALSE, only the first frame of the specified environment is inspected. If inherits is TRUE, the search is continued up through the parent frames until a bound value of the right mode is found.

Using a NULL environment is equivalent to using the current environment.

See Also

exists.

Examples

get("%o%")

[Package base version 1.5.0 ]