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 <[email protected]> wrote: From: Michael Knudsen <[email protected]> Subject: Re: [R] how to determine if a variable is already set? To: "carol white" <[email protected]> Cc: [email protected] Date: Sunday, September 13, 2009, 7:06 AM On Fri, Sep 11, 2009 at 7:15 PM, carol white <[email protected]> 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 [email protected] http://lifeofknudsen.blogspot.com/ [[alternative HTML version deleted]] ______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

