Rev 15439 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
\name{get}\alias{get}\title{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{\item{x}{a variable name (given as a quoted character string).}\item{pos}{where to look for the object (see the details section); ifomitted, the function will search, as if the name of the objectappeared in unquoted in an expression.}\item{envir}{an alternative way to specify an environment to look in;see the details section.}\item{mode}{the mode of object sought.}\item{inherits}{should the enclosing frames of the environment beinspected?}}\details{The \code{pos} argument can specify the environment in which to lookfor the object in any of several ways:as an integer (the position in the \code{\link{search}} list); asthe character string name of an element in the search list; or as an\code{\link{environment}} (including using \code{\link{sys.frame}} toaccess the currently active function calls).The \code{envir} argument is an alternative way to specify anenvironment, but is primarily there for back compatibility.The \code{mode} includes collections such as \code{"numeric"} and\code{"function"}: any member of the collection will suffice.}\value{This function searches the specified environment for a bound variablewhose name is given by the character string \code{x}. If thevariable's value is not of the correct \code{mode}, it is ignored.If \code{inherits} is \code{FALSE}, only the first frame of thespecified environment is inspected. If \code{inherits} is\code{TRUE}, the search is continued up through the parent framesuntil a bound value of the right mode is found.Using a \code{NULL} environment is equivalent to using the currentenvironment.}\seealso{\code{\link{exists}}.}\examples{get("\%o\%")}\keyword{data}