Thanks to your replies. 

In fact, the problem doesn't come from "exists" but from "stop" that displays Error even if call. = FALSE. To answer to Dan, I quoted the pramater of exists. So when the variable is not defined, stop displays the expression message preceded by "Error". So the question was how not to display "Error" or if there is another function that does stop's job without displaying "Error"?

Cheers,

--- On Sun, 9/13/09, Michael Knudsen <micknudsen@gmail.com> wrote:

From: Michael Knudsen <micknudsen@gmail.com>
Subject: Re: [R] how to determine if a variable is already set?
To: "carol white" <wht_crl@yahoo.com>
Cc: r-help@stat.math.ethz.ch
Date: Sunday, September 13, 2009, 7:06 AM

On Fri, Sep 11, 2009 at 7:15 PM, carol white <wht_crl@yahoo.com> wrote:

> It might be a primitive question but how it is possible to determine if a variable is initialized in an environment?

What about this?

> "x" %in% ls()
[1] FALSE
> x = 41
> "x" %in% ls()
[1] TRUE

Best,
Michael

-- 
Michael Knudsen
micknudsen@gmail.com
http://lifeofknudsen.blogspot.com/



      
	[[alternative HTML version deleted]]


