[R] Weird problem with median on a factor

Simon Fear Simon.Fear at synequanon.com
Fri Oct 31 12:18:20 CET 2003


Final guess as to observed behaviour: in the first case after
removal of NAs there were an odd number of observations
(so that sum was not called within the code for median).
In your second call I suspect that even though you got
an integer answer, it was found as sum(2,2)/2.

It seems to me the best way to deal with this "bug" would
be to make calling median with a factor argument be an 
immediate error. Or just trust users never to attempt such
a thing ...  
 
Simon Fear 
Senior Statistician 
Syne qua non Ltd 
Tel: +44 (0) 1379 644449 
Fax: +44 (0) 1379 644445 
email: Simon.Fear at synequanon.com 
web: http://www.synequanon.com 
  
Number of attachments included with this message: 0 
  
This message (and any associated files) is confidential and\...{{dropped}}




More information about the R-help mailing list