Quotation marks help also for exists():

exists( "meanedf" )
[1] TRUE


On Saturday 07 November 2015 04:48:04 Margaret Donald wrote:
> I have a variable meanedf which may sometimes not be defined due to a
> complex set of circumstances.
> I would like to be able to find out whether or not it exists, and then
> branch appropriately in my code.
> 
> I had hoped to be able to use is.null() or exists() but neither of these
> returns TRUE or FALSE which is the behaviour I would like, so that I can
> write some appropriate branching code.
> 
> is.null(meanedf)
> Error: object 'meanedf' not found
> No suitable frames for recover()
> 
> exists(meanedf)
> Error in exists(meanedf) : object 'meanedf' not found
> 
> I would like some code which returns TRUE when meanedf exists and FALSE
> when it doesn't.
> 
> Thanks, and regards,
> Margaret Donald
> 
> 
>

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.

Reply via email to