[Rd] Problem with args
Simon Urbanek
simon.urbanek at r-project.org
Sat Apr 21 20:10:51 CEST 2012
On Apr 21, 2012, at 1:45 PM, Gabor Grothendieck wrote:
> On Sat, Apr 21, 2012 at 1:38 PM, Simon Urbanek
> <simon.urbanek at r-project.org> wrote:
>>
>> On Apr 21, 2012, at 1:03 PM, Gabor Grothendieck wrote:
>>
>>> args ought to check that its argument is a function:
>>>
>>>> max <- 3
>>>> args(max)
>>> NULL
>>>
>>> e.g.
>>>
>>>> args <- function(name) {
>>> + name <- match.fun(name)
>>> + base::args(name)
>>> + }
>>>> args(max)
>>> function (..., na.rm = FALSE)
>>> NULL
>>>
>>
>> You may want to read the docs in the first place:
>>
>> Value:
>> [...]
>>
>> 'NULL' in case of a non-function.
>>
>
> 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.
>
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
> args("max")
function (..., na.rm = FALSE)
NULL
(again, see the documentation).
More information about the R-devel
mailing list