exists(x, where = -1, envir = if (missing(frame)) as.environment(where) else sys.frame(frame), frame, mode = "any", inherits = TRUE)
x | a character string representing the object to be found. |
where | specifies the environment in which to find the object. exists accepts several ways to specify the environment. See Details for more information. |
envir | an alternative way to specify the environment to find the object. |
frame | a frame used in calling list. If provided, the default value of envir is set to sys.frame(frame). |
mode | a character string giving the mode wanted for the object. The default, "any", means that any mode is acceptable. |
inherits |
a logical flag. If TRUE (the default), specifies searching
parent frames. Normally, only the current frame, the global frames,
and databases are searched for an object.
If inherits=TRUE, the parent frame of the current frame, its parent frame, and all further ancestors are searched. |
exists("CO2", where="package:stats") # [1] TRUE
exists("CO2", where=2) # [1] TRUE