Re: [R] Testing for existence of object within a function

2010-10-08 Thread Eli Holmes
Thanks for the help. After looking over the answers, I've come up with some revised code: # To simply test if an argument was passed in, missing() can be used # However, if arg defined later, missing() will return TRUE instead of false a=1 #put a in global environment tst <- function(a,b=1) { if

[R] Testing for existence of object within a function

2010-10-07 Thread Eli Holmes
I'm trying to test for the existence of an object within a function, but despite searching the help files and R-list, I can't figure out how to do it. Here is some test code: #- a=1 #now I have a in the global environment tst <- function(a,b=1) { # but a is not in the loc