[R] summary gives inaccurate data
Thomas Lumley
thomas at biostat.washington.edu
Wed Jun 9 23:18:25 CEST 1999
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
This is due to rounding to 4 significant figures. You can do eg
R> summary(c(123456,1,2,3),digits=8)
Min. 1st Qu. Median Mean 3rd Qu. Max.
1.00 1.75 2.50 30865.50 30866.25 123456.00
to get more accuracy
Thomas Lumley
Assistant Professor, Biostatistics
University of Washington, Seattle
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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