Re: [Rd] Accuracy in summary (PR#7121)

From: <murdoch_at_stats.uwo.ca>
Date: Wed 21 Jul 2004 - 00:13:30 EST


On Tue, 20 Jul 2004 15:54:49 +0200 (CEST), sandy@stat.umn.edu wrote :

>Full_Name: Sanford Weisberg
>Version: 1.9.1
>OS: Win XP
>Submission from: (NULL) (160.94.148.2)
>
>
>> wm <- read.table(url("http://www.stat.umn.edu/~sandy/wmdata0.txt"),
>header=TRUE)
>> mean(wm$Spd1)
>[1] 7.7773
>> summary(wm$Spd1)
> Min. 1st Qu. Median Mean 3rd Qu. Max.
> 0.222 4.780 7.550 7.780 10.200 21.600
>
>The mean of this variable DOES NOT ROUND to the value shown in the summary
>output.

This is not a bug. summary.default() is behaving as documented. You asked (by default) for 3 significant figures, and that's what you got.

>
>> options(digits=6)
>> mean(wm$Spd1)
>[1] 7.77733
>> summary(wm$Spd1)
> Min. 1st Qu. Median Mean 3rd Qu. Max.
> 0.222 4.780 7.550 7.780 10.200 21.600
>
>This is still wrong. Also, the minimum value is 0.2221, which should have been
>printed in full given digits=6.

No, see the man page.

Duncan Murdoch



R-devel@stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-devel Received on Wed Jul 21 00:17:36 2004

This archive was generated by hypermail 2.1.8 : Wed 03 Nov 2004 - 22:45:03 EST