[R] Which.min bug?

Elliot Williams ewilliams at ucsd.edu
Tue Feb 13 22:22:15 CET 2001


I'm not sure this is a bug, so I thought I'd bounce it off the help group 

I had a dataset which I was subsetting, and occasionally I get an empty 
subset.  If I don't check for emptiness and go straight to a which.min call 
on the subset, the program gets a big negative number back.

One-line Example:
> which.max(NULL)
[1] -2147483647

This caused an indexing error which was hard(ish) to track down.  Should it 
just return NA or throw an error?  Should I re-submit to r-bugs?  Or is there 
some deep reason for this behavior that I don't understand?

Elliot Williams (ewilliams at ucsd.edu)
Economics Department, UC San Diego

r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list