[Rd] as.missing

Paul Gilbert pgilbert at bank-banque-canada.ca
Fri Oct 27 15:55:46 CEST 2006



Bjørn-Helge Mevik wrote:

>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.
>  
>
Yes, that is the behaviour I am looking for. That is, f  should do what 
it normal would do if it were called with x missing.
====================================================================================

La version française suit le texte anglais.

------------------------------------------------------------------------------------

This email may contain privileged and/or confidential inform...{{dropped}}




More information about the R-devel mailing list