[R] Testing for existence inside a function
topkatz at msn.com
Tue May 15 16:48:31 CEST 2007
I'm having trouble testing for existence of an object inside a function.
Suppose I have a function:
and I call it with argument y:
I'd like to check inside the function whether argument y exists. Is this
possible, or do I have to either check outside the function or pass the name
of the argument as a separate argument?
If I do exists(x) or exists(eval(x)) inside the function and y does not
exist, it generates an error message. If I do exists("x") it says that x
exists even if y does not. If I had a separate argument to hold the text
string "y" then I could check that. But is it possible to check the
existence of the argument inside the function without passing its name as a
-- TMK --
More information about the R-help