RE: [Rd] recursive default argument reference

From: Liaw, Andy <andy_liaw_at_merck.com>
Date: Wed 10 Nov 2004 - 12:43:52 EST


> 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@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
>



R-devel@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Wed Nov 10 12:50:53 2004

This archive was generated by hypermail 2.1.8 : Wed 10 Nov 2004 - 13:10:02 EST