[R] Error:non-numeric argument in my function

Patrick Burns pburns at pburns.seanet.com
Mon Jun 1 10:34:48 CEST 2009


I thought Stavros' suggestion was going
to be to have the error message say what
type of offending object was found.  If
the message said that a list of class
'data.frame' was found (probably the leading
case), then that would be much more helpful.

Patrick Burns
patrick at burns-stat.com
+44 (0)20 8525 0696
http://www.burns-stat.com
(home of "The R Inferno" and "A Guide for the Unwilling S User")

Stavros Macrakis wrote:
> On Sun, May 31, 2009 at 6:10 PM, jim holtman <jholtman at gmail.com> wrote:
> 
>> Message is very clear:
>>
>>> 1 * 'a'
>> Error in 1 * "a" : non-numeric argument to binary operator
> 
> 
> Though the user should have been able to figure this out, perhaps the error
> message could be improved? After all, it is not the fact that the operator
> is *binary* that implies that its argument must be numeric, but that it is
> *arithmetic*. The binary operator %in%, for example, takes non-numeric
> arguments.
> 
> Suggested replacement error message:
> 
>      non-numeric argument to arithmetic operator
> 
>                -s
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>




More information about the R-help mailing list