I'm a bit confused about how exists() work within a function -- I want
to test for unassigned variables, but I'm doing tests in the main
environment to figure out the function, so the variables DO exist in
the parent environment of a function call.

Why does:
myfunction <- function(variable_outside_function)
{
        print(exists("variable_outside_function",inherit=FALSE))
        print(exists("another_variable_outside_function",inherit=FALSE))
}

myfunction()

Return:
[1] TRUE
[1] FALSE

I didn't assign anything to variable_outside_function, so I'm unclear
why it thinks it exists...

--j

______________________________________________
R-help@r-project.org 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.

Reply via email to