[Rd] Accuracy problems in summary()? (PR#4101)

Graeme.Ambler at bristol.ac.uk Graeme.Ambler at bristol.ac.uk
Mon Sep 8 15:57:48 MEST 2003


Full_Name: Graeme Ambler
Version: 1.7.1
OS: Red Hat Linux 9
Submission from: (NULL) (137.222.80.161)


There seems to be a curious accuracy-related problem in summary().  Try the
following:

test<-matrix(rnorm(2000),nc=2)
summary(test)
summary(test[,1])

The first use of summary() is fine.  The second will lie to you about the
accuracy to which numbers are displayed.  The results I got were:

> summary(test)
       X1                 X2
 Min.   :-2.68358   Min.   :-3.780882
 1st Qu.:-0.67451   1st Qu.:-0.721148
 Median : 0.01577   Median : 0.006311
 Mean   : 0.00644   Mean   :-0.022287
 3rd Qu.: 0.69642   3rd Qu.: 0.630215
 Max.   : 3.11174   Max.   : 2.827698
> summary(test[,1])
    Min.  1st Qu.   Median     Mean  3rd Qu.     Max.
-2.68400 -0.67450  0.01577  0.00644  0.69640  3.11200

Accuracy in the second case always seems to be 4SF, yet 6 are displayed in some
cases.  I have been able to reproduce this bug with 100% reliability.  Apologies
if this has been reported before, I couldn't find it when I searched.



More information about the R-devel mailing list