[Rd] recursive default argument reference

Liaw, Andy andy_liaw at merck.com
Wed Nov 10 02:43:52 CET 2004


> From: Vadim Ogranovich
> 
> Hi,
> 
> It seems that a formal function argument can not default to an "outer"
> variable of the same name:
> 
> > x <- "foo"

This is just a red herring...  Even w/o this you get the same thing:

> ff <- function(x=x) x
> ff()
Error in ff() : recursive default argument reference
> ff(x)
Error in ff(x) : Object "x" not found

Note how the two errors are different.

> > ff <- function(x=x) x
> > ff()
> Error in ff() : recursive default argument reference
> > 
> 
> Is this intentional? Why?

It should be, because R doesn't know what to make of it (and neither do I).
 
Cheers,
Andy

> I use R-1.9.1.
> 
> Thanks,
> Vadim
> 
> ______________________________________________
> R-devel at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
> 
>



More information about the R-devel mailing list