[R] Summary bug?

Prof Brian D Ripley ripley at stats.ox.ac.uk
Tue Oct 19 08:37:55 CEST 1999


On Mon, 18 Oct 1999, Alvaro A. Novo wrote:

> It seems that there's a bug in summary, in the max. output... but max() alone
> works fine.
> 
> > hw04.dframe$area
> ...
>  [41]   1790   1380   1296   2745    798   2306 438649   1481   1559   2450
> ...
> 
> > summary(hw04.dframe)
>       area       
>  Min.   :   798  
>  1st Qu.:  1349  
>  Median :  1690  
>  Mean   :  6962  
>  3rd Qu.:  2306  
>  Max.   :438600  ### should read 438649
> 
> or, to the point,
> 
> > summary(hw04.dframe$area)
>    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
>     798    1349    1690    6962    2306  438600 
> 				       ### should be 438649
> 
> > max(hw04.dframe$area)
> [1] 438649
> > is.data.frame(hw04.dframe)
> [1] TRUE

This is a feature: summary prints to `digits' significant figures, default
4 (options("digits") - 3).  The idea is not to swamp you with detail in a
summary. As in:

> summary(438649)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
 438600  438600  438600  438600  438600  438600 
> signif(438649, 4)
[1] 438600

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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