Skip to content

Problem with args

5 messages · Gabor Grothendieck, Simon Urbanek

#
args ought to check that its argument is a function:
NULL

e.g.
+     name <- match.fun(name)
+     base::args(name)
+ }
function (..., na.rm = FALSE)
NULL
#
On Apr 21, 2012, at 1:03 PM, Gabor Grothendieck wrote:

            
You may want to read the docs in the first place:

Value:
[...]

     'NULL' in case of a non-function.

Cheers,
S
#
On Sat, Apr 21, 2012 at 1:38 PM, Simon Urbanek
<simon.urbanek at r-project.org> wrote:
My post wasn't about the return value -- it was about the fact that
the function name can be masked.  Try the example I posted.  I also
posted a solution.
#
On Apr 21, 2012, at 1:45 PM, Gabor Grothendieck wrote:

            
You're passing a non-function (the value of 3) so, obviously you get NULL. I think you're confusing function calls with values. What you probably intended was
function (..., na.rm = FALSE) 
NULL

(again, see the documentation).
#
On Sat, Apr 21, 2012 at 2:10 PM, Simon Urbanek
<simon.urbanek at r-project.org> wrote:
That's only a workaround but it does not address the problem that args
ought not to work that way.  args can gather all the information
needed to fetch the correct object but doesn't.  The second example
shows how it should work.