[R] Detect the presence of an object

Marc Schwartz MSchwartz at medanalytics.com
Fri Jan 30 22:42:19 CET 2004


On Fri, 2004-01-30 at 14:58, Francisco J Molina wrote:
> Is there a  function like "is.there" such that 
> 
> is.there ( a ) returns TRUE is object 'a' is in the current environment and
> FALSE otherwise?
> 
> Thank you.
> Francisco J. Molina


See ?exists

This requires that the object of interest is quoted:

> a <- "I am here"
> exists(a)
[1] FALSE
> exists("a")
[1] TRUE

There are other arguments to the function to indicate where to search,
etc.

HTH,

Marc Schwartz




More information about the R-help mailing list