[Rd] as.missing
Bjørn-Helge Mevik
bhs2 at mevik.net
Fri Oct 27 11:09:17 CEST 2006
Gabor Grothendieck wrote:
> This is what I get:
>
>> as.missing <- force
>> f <- function(y, x=1) {cat(missing(x)) ; x}
>> g <- function(x=as.missing()) f(3,x)
>> g()
> FALSEError in as.missing() : argument "x" is missing, with no default
>> traceback()
> 3: as.missing()
> 2: f(3, x)
> 1: g()
>> traceback()
> 3: as.missing()
> 2: f(3, x)
> 1: g()
>
> so g did in fact pass the missing to f and it was only f that blew up,
> not g. If that's not what you want please explain.
I _think_ what he wants is:
> g()
TRUE[1] 1
I.e., when x is missing in g, and g calls f(3,x), f will use its
default value for x.
--
Bjørn-Helge Mevik
More information about the R-devel
mailing list