From jmount at win-vector.com  Fri Aug 19 17:04:55 2016
From: jmount at win-vector.com (John Mount)
Date: Fri, 19 Aug 2016 08:04:55 -0700
Subject: [Rd] summary.default rounding on numeric seems inconsistent with
	other R behaviors
Message-ID: <944E96FB-9C3B-46A3-9C57-8AF8EAA5284A@win-vector.com>

I was wondering if it would make sense to change the default behavior of the following:

summary(15555L)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   15560   15560   15560   15560   15560   15560 

summary.default on numeric values rounds values (not just presentation) to getOption("digits")-3L (or four) digits by default, making those values surprising and less suitable for further calculation.  Summary on matrix and data.frame do not do so.

It seems it would be nice to have x=15555L; summary(x)[['Min.']] == min(x) evaluate to TRUE.  I know one can alter behavior by changing the global ?digits? option, but I don?t know what other impacts that might have.  Ideally I would think summary.default would not round its values at all, but use digits to control presentation (by overriding print and such).  Even in presentation the rounding without switching to scientific notation (such as 1.556e+4) is a bit surprising (I understand rounding and scientific notation are two different presentation issues, but new users are very confused that something that appears to be an integer has been rounded).

Example:

summary(data.frame(x=15555))
##        x        
##  Min.   :15555  
##  1st Qu.:15555  
##  Median :15555  
##  Mean   :15555  
##  3rd Qu.:15555  
##  Max.   :15555  
summary(15555)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   15560   15560   15560   15560   15560   15560 

I have a (bit whiny) polemic trying to explain the pain point here http://www.win-vector.com/blog/2016/08/my-criticism-of-r-numeric-summary/ <http://www.win-vector.com/blog/2016/08/my-criticism-of-r-numeric-summary/> (I am not trying to be rude, more I am trying to emphasize why this can be confusing to new users).



---------------
John Mount
http://www.win-vector.com/ <http://www.win-vector.com/> 
Our book: Practical Data Science with R http://www.manning.com/zumel/ <http://www.manning.com/zumel/>




	[[alternative HTML version deleted]]



[Rd] summary.default rounding on numeric seems inconsistent with other R behaviors
John Mount