[R] function parameters - testing

Larry Howe linux at comjet.com
Fri Jun 9 23:43:32 CEST 2006


On Friday June 9 2006 16:06, Sundar Dorai-Raj wrote:
> Larry Howe wrote:

>
> This works because "x" exists in the function "f". Perhaps you want this
> instead?
>
> f <- function(x) {
>    print(deparse(substitute(x)))
>    print(exists(deparse(substitute(x))))
>    print(is.null(x))
>    invisible()
> }

Your example code works, but when I try to apply it to my function, it does 
not behave as expected. My variable seems to exist before I pass it into the 
function, but once inside the function it does not exist.

I guess what I need is an in-depth guide to functions: scoping, arguments, 
parameters, etc. I am also becoming curious about how to pass values out of a 
function. Can someone point me in the right direction?

Larry



More information about the R-help mailing list