Hi all, I have a list with a numerical column "cum_hardreuses". By coincidence I discovered this:> max(libs[,"cum_hardreuses"])[1] 1793> summary(libs[,"cum_hardreuses"])Min. 1st Qu. Median Mean 3rd Qu. Max. 1 2 4 36 14 1790 (note the max value of 1790) Ouch this is bad! Anything I can do to remedy this? Known bug? This is a Version 1.16 (3198) of the MacOSX R. Regards, Sebastian Spaeth
Sebastian Spaeth wrote:> Hi all, > I have a list with a numerical column "cum_hardreuses". By coincidence I > discovered this: > >> max(libs[,"cum_hardreuses"]) > [1] 1793 > >> summary(libs[,"cum_hardreuses"]) > Min. 1st Qu. Median Mean 3rd Qu. Max. > 1 2 4 36 14 1790 > > (note the max value of 1790) Ouch this is bad! Anything I can do to remedy > this? Known bug?No, it's a feature! See ?summary: printing is done up to 3 significant digits by default. If you want it more precise, for example use: summary(libs[,"cum_hardreuses"], digits=10) Uwe Ligges> This is a Version 1.16 (3198) of the MacOSX R. > > Regards, > Sebastian Spaeth > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.
On Mon, 2006-12-04 at 12:04 +0100, Sebastian Spaeth wrote:> Hi all, > I have a list with a numerical column "cum_hardreuses". By coincidence I > discovered this: > > > max(libs[,"cum_hardreuses"]) > [1] 1793 > > > summary(libs[,"cum_hardreuses"]) > Min. 1st Qu. Median Mean 3rd Qu. Max. > 1 2 4 36 14 1790 > > (note the max value of 1790) Ouch this is bad! Anything I can do to remedy > this? Known bug?Did you read ?summary, which has: ## Default S3 method: summary(object, ..., digits = max(3, getOption("digits")-3)) so this is a rounding issue of the *printed* representation of the summary. Just change digits to be a larger number:> dat <- rnorm(100) > max(dat)[1] 2.434443> summary(dat)Min. 1st Qu. Median Mean 3rd Qu. Max. -2.21100 -0.65450 0.03793 0.06919 0.84650 2.43400> summary(dat, digits = 10)Min. 1st Qu. Median Mean 3rd Qu. Max. -2.21106232 -0.65451716 0.03793040 0.06919486 0.84652269 2.43444263> # same with integer as in your example > dat <- floor(dat * 1000000) > max(dat)[1] 2434442> summary(dat)Min. 1st Qu. Median Mean 3rd Qu. Max. -2211000 -654500 37930 69190 846500 2434000> summary(dat, digits = 10)Min. 1st Qu. Median Mean 3rd Qu. Max. -2211063.00 -654517.50 37930.00 69194.38 846522.00 2434442.00 HTH G> > This is a Version 1.16 (3198) of the MacOSX R. > > Regards, > Sebastian Spaeth > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.-- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Gavin Simpson [t] +44 (0)20 7679 0522 ECRC & ENSIS, UCL Geography, [f] +44 (0)20 7679 0565 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/ UK. WC1E 6BT. [w] http://www.freshwaters.org.uk %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Brian Ripley wrote:> 'Unfortunately' you give no credentials for your ex cathedra > pronouncement. E.g. > > http://en.wikipedia.org/wiki/Significant_digits > > says > > The situation regarding trailing zero digits that fall to the left of > the decimal place in a number with no digits provided that fall to > the right of the decimal place is less clear, but these are typically > not considered significant unless the decimal point is placed at the > end of the number to indicate otherwise (e.g., "2000." versus > "2000"). To make things more clear, trailing zeros are only > recognized as significant figures if the number they are a part of > has a decimal point. For example, 450 only has two sig figs, but 450. > has three. > > which directly contradicts you. So this is at best a matter of > opinion, and credentials do matter for opinions.In the elementary statistics text ``Statistics for the Life Sciences'' (Samuels and Witmer, Prentice-Hall, 3rd ed.; fairly respectable credentials) there is an appendix on Significant Digits which says, amongst other things: ``How many significant digits are in the number 23000? When the number is expressed in this way --- in ordinary rather than scientific notation --- it is not really possible to tell how many significant digits it has.'' .... ``Scientific notation removes the ambiguity.'' Determining the significance of digits from the presence of a decimal point is perhaps a ``reasonable'' convention, but it is certainly not one that is widely practiced or understood. Relying on an obscure convention is fraught with risk. cheers, Rolf Turner rolf at math.unb.ca