exists {env} R Documentation

Is an Object Defined?

Description


Look for an R object of the given name and possibly return it

Usage

exists(name);

Arguments

name

a variable name (given As a character String Or a symbol). [as string]

envir

where to look for the object (see the details section); if omitted, the function will search as if the name of the object appeared unquoted in an expression. an alternative way To specify an environment To look In, but it Is usually simpler To just use the where argument. [as Environment]

Details

Authors

SMRUCC genomics Institute

Value

Logical, true if and only if an object of the correct name and mode is found.

clr value class

Examples

 const myEnvir = globalenv();
 
 if (exists(myVarName, envir = myEnvir)) {
    r <- get(myVarName, envir = myEnvir)
    ## ... deal with r ...
 }

[Package env version 2.33.856.6961 Index]