Skip to content

Missing argument error message

3 messages · Barry Rowlingson, Hrishi Mittal, Brian Ripley

#
Back in the days of R 2.6, if you did this, you got this:
Error in z() : argument "x" is missing, with no default

 But now in this decade we get (for R 2.9 and 2.10):
Error in z() :
  element 1 is empty;
   the part of the args list of '*' being evaluated was:
   (x, 2)

Now I can see (after thinking about it) that what is happening is that
because of lazy evaluation or something the 'x' isn't getting spotted
as being empty until R tries to do x*2, which obviously maps to *(x,2)
in functional form. It's perfectly correct to say element 1 of the
args list of '*', being (x,2), is empty.

But which of those two errors above is clearer? I don't suppose much
can be done about this since it is going to the guts of modern R, and
I was surprised my initial searches didn't find hordes of confused
newbies. Just me then. It got me when I was doing a histogram of some
dates:
Error in inherits(breaks, "POSIXt") :
  element 1 is empty;
   the part of the args list of '.Internal' being evaluated was:
   (x, what, which)

 who what which? If the error had been "Error in hist(cases): argument
'breaks' is missing, with no default" you wouldn't be wasting your
time reading this now...

Barry
#
Thanks for pointing this out Barry. I wonder what led to that change and if
there is a way to revert back to the old style. 

I suspect the reason you didn't find hordes of confused newbies is that
newbies don't read error messages.

-----
Hrishi Mittal
hrishimittal at gmail.com

Try  http://prettygraph.com Pretty Graph , the easiest way to make R-powered
graphs on the web.
#
But in 2.10.1 patched
Error in x * 2 : 'x' is missing

[See the posting guide about checking current versions before posting 
...  My notes say the change was in 2.8.0 and a side effect of 
something else rather than deliberate.]
On Thu, 28 Jan 2010, Barry Rowlingson wrote: