[R] Why does 'exists' need a quoted argument?

Wright, Kevin kevin.wright at pioneer.com
Thu Feb 20 15:53:02 CET 2003


Some functions in R need quoted arguments.  Consider this list:

help(rm)
rm(a)
is.na(a)
get("rm")
exists("rm")

Can someone explain why 'get' and 'exists' require quoted object names?

Would it make sense (more consistency) to have these functions check to see if the first argument is a string, and if not, then 'substitute' it?    Intuitively, 'exists' is checking to see if an object exists, not to see if a character string exists.  Evidently my intuition is wrong.

I can see that 'get' might need to have the option of using quotes, for example, get("?") or get("*").  However, look at this: 

> is.function(?)
Error: syntax error
> is.function("?")
[1] FALSE

I grow used to not quoting things and then stumble over 'exists' from time to time.

Looking forward to clarity or maybe a request for change.

Kevin Wright



This communication is for use by the intended recipient and cont ... [[dropped]]




More information about the R-help mailing list