michael.m.spiegel at gmail.com
2009-Aug-28 21:00 UTC
[Rd] c() poor error reporting (PR#13917)
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. 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.
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