Talbot Katz wrote: > > I'm having trouble testing for existence of an object inside a function. > No, you are having trouble testing for existence of an object _before_ the function is called :-)
> Suppose I have a function: > > f<-function(x){ > ... > } > > and I call it with argument y: > > f(y) > > I'd like to check inside the function whether argument y exists. > This can't be done, because the error happens before f is called. Try this: f <- function(x) x + 1 f(y.does.not.exist) y.does.not.exist The error message is (almost) the same, and it happens when parsing the line. There's no way to change f to change this. Alberto Monteiro ______________________________________________ R-help@stat.math.ethz.ch 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.