Skip to content
Prev 38938 / 63424 Next

Missing argument vs. empty argument

On Tue, 25 Jan 2011, Renaud Gaujoux wrote:

            
An empty argument is a missing argument when argument matching is 
done, e.g.
foo(i = i)
foo(i = i)
foo(j = j)

It is rather against the spirit of R to use the actual call rather 
than the matched call.  Unless you are doing this to write a '[' 
method I would suggest you find a different convention, e.g. 
distinguish f(i) and f(i, NULL).  For the exception, look at 
`[.data.frame`, which does use nargs().

(NB: what I have said does not apply to primitives like '[' itself, 
which do not do standard argument matching.)