[R] summary gives inaccurate data

Robert Gentleman rgentlem at hsph.harvard.edu
Wed Jun 9 23:13:04 CEST 1999


Chris,
 Looking at the man page for summary,
> ?summary
 
Object Summaries
 
     summary(object, ...)
 
     summary.default   (object, ..., digits = max(3, .Options$digits -3))
     summary.data.frame(object, maxsum = 7, ...)
     summary.factor    (object, maxsum = 100, ...)
     summary.matrix    (object, ...)
 
Arguments:
 
Shows that the "problem" is the digits option. It is 4 in your case, so
you only see 4 significant digits.
Change it to:
> summary(c(123456,1,2,3), digits=7)
     Min.   1st Qu.    Median      Mean   3rd Qu.      Max. 
     1.00      1.75      2.50  30865.50  30866.25 123456.00 

and you get what you want. In most cases the number of "significant
digits" printed out by summary methods in R is truncated to 3 or 4.

robert

On Wed, 9 Jun 1999, Christoph M. Friedrich wrote:

> Hi,
> using R64.1 the summary function for simple statistics of a vector gives
> inaccurate
> results for the maximum. 
> Example:
> summary(c(123456,1,2,3))
> 
> gives :
> 
>      Min.   1st Qu.    Median      Mean   3rd Qu.      Max. 
>      1.00      1.75      2.50  30870.00  30870.00 123500.00 
> 
> The Max value ist wrong in a mathematical sense. I've tried with S-Plus,
> it gives the same result,
> but this seems to be inaccurate. 
> 
> Any suggestions for this problem
> 
>    Chris
> 
> -- 
> Christoph M. Friedrich        | mailto:friedrich at computer.org 
> Gesellschaft für Modulfermenterbau mbH (GfM mbH) |
> http://www.tussy.uni-wh.de/~chris
> Alfred-Herrhausen Str. 44 ; D-58455 Witten, Germany
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> 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
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
> 

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