[Rd] c() poor error reporting (PR#13917)

Michael Spiegel michael.m.spiegel at gmail.com
Mon Aug 31 05:21:52 CEST 2009


Hi,

Thanks.  I think I failed to communicate what I believe should be
corrected.  The error message itself contains correct information, it
is what is missing from the error message that is desired.  The
message "argument is missing, with no default" does not inform the
user in what function the error occured.  I have the good sense to run
traceback() and figure out where the error occured.  But several of
the users in the R package we maintain write horribly nested scripts
"foo(bar(baz(quux(c(,'a','b','c')))))" and don't incrementally test
their programs. I am proposing the error message state "in function
c() an argument is missing, with no default". It's an issue of
usability, but granted not a major issue.  I will not be able to
submit a patch in the near future, but thank you for the reply.

--Michael

On Sat, Aug 29, 2009 at 5:53 PM, Duncan Murdoch<murdoch at stats.uwo.ca> wrote:
> On 28/08/2009 5:00 PM, michael.m.spiegel at gmail.com wrote:
>>
>> Full_Name: Michael Spiegel
>> Version: 2.9.1
>> OS: linux
>> Submission from: (NULL) (137.54.6.192)
>>
>>
>> The function c() gives a cryptic error message if an "empty" argument is
>> accidentally passed to the function.
>
> I wouldn't call that cryptic. You put in a blank argument, and it told you
> the argument was missing.
>
> The expression c(,,,) yields the error
>>
>> message "argument is missing, with no default".  For comparison, the
>> expression
>> sum(,,,) yields the error message "element 1 is empty; the part of the
>> args list
>> of 'sum' being evaluated was: (, , , )".  This type of error was produced
>> by
>> accidentally typing an expression similar to "sum(c(,1,2,3))" which was a
>> sub-expression inside a much larger expression spanning tens of lines.
>>  When the
>> entire expression was evaluated, the error message "argument is missing,
>> with no
>> default" provides little context for determining the cause of the error.
>
> Yes, sum() is more friendly in its error reporting.  This hardly qualifies
> as a bug, but if you want to submit a patch, it would be considered.
>
> Duncan Murdoch
>



More information about the R-devel mailing list