Hi, It seems that there's a bug in summary, in the max. output... but max() alone works fine.> hw04.dframe$area... [41] 1790 1380 1296 2745 798 2306 438649 1481 1559 2450 ...> summary(hw04.dframe)area Min. : 798 1st Qu.: 1349 Median : 1690 Mean : 6962 3rd Qu.: 2306 Max. :438600 ### should read 438649 or, to the point,> summary(hw04.dframe$area)Min. 1st Qu. Median Mean 3rd Qu. Max. 798 1349 1690 6962 2306 438600 ### should be 438649> max(hw04.dframe$area)[1] 438649> is.data.frame(hw04.dframe)[1] TRUE Alvaro A. Novo R-0.65.1 Linux SuSE 6.1 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Alvaro> Hi, It seems that there's a bug in summary, in the Alvaro> max. output... but max() alone works fine. Alvaro> hw04.dframe$area Alvaro> ... Alvaro> [41] 1790 1380 1296 2745 798 2306 438649 1481 1559 2450 Alvaro> ... Alvaro> summary(hw04.dframe) Alvaro> area Alvaro> Min. : 798 Alvaro> 1st Qu.: 1349 Alvaro> Median : 1690 Alvaro> Mean : 6962 Alvaro> 3rd Qu.: 2306 Alvaro> Max. :438600 ### should read 438649 Alvaro> or, to the point, Alvaro> summary(hw04.dframe$area) Alvaro> Min. 1st Qu. Median Mean 3rd Qu. Max. Alvaro> 798 1349 1690 6962 2306 438600 Alvaro> ### should be 438649 Alvaro> max(hw04.dframe$area) Alvaro> [1] 438649 Alvaro> is.data.frame(hw04.dframe) Alvaro> [1] TRUE There's no bug. It's a feature -- inherited from S > args(summary.default) or ?summary {please read the doc before posting...} shows you function (object, ..., digits = max(3, .Options$digits - 3)) I.e. by default, options(digits = 7) and you get four digits. Usually with numbers of vastly different size, you get exponential representation with 4 digits each,> summary(as.data.frame(x <- c(rnorm(20),pi* 10^c(0:2,5))))x Min. :-2.056e+00 1st Qu.:-1.023e+00 Median : 2.774e-01 Mean : 1.310e+04 3rd Qu.: 1.428e+00 Max. : 3.142e+05 but I agree that in the above case it can be quite confusing as e.g. in the following (just a different random sample)> summary(as.data.frame(x <- c(rnorm(20),pi* 10^c(0:2,4))))x Min. : -1.3250 1st Qu.: -0.4386 Median : 0.2091 Mean : 1324.0000 3rd Qu.: 0.7687 Max. :31420.0000 ------- "Solution": Use summary(...., digits= 10) -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
On Mon, 18 Oct 1999, Alvaro A. Novo wrote:> It seems that there's a bug in summary, in the max. output... but max() alone > works fine. > > > hw04.dframe$area > ... > [41] 1790 1380 1296 2745 798 2306 438649 1481 1559 2450 > ... > > > summary(hw04.dframe) > area > Min. : 798 > 1st Qu.: 1349 > Median : 1690 > Mean : 6962 > 3rd Qu.: 2306 > Max. :438600 ### should read 438649 > > or, to the point, > > > summary(hw04.dframe$area) > Min. 1st Qu. Median Mean 3rd Qu. Max. > 798 1349 1690 6962 2306 438600 > ### should be 438649 > > > max(hw04.dframe$area) > [1] 438649 > > is.data.frame(hw04.dframe) > [1] TRUEThis is a feature: summary prints to `digits' significant figures, default 4 (options("digits") - 3). The idea is not to swamp you with detail in a summary. As in:> summary(438649)Min. 1st Qu. Median Mean 3rd Qu. Max. 438600 438600 438600 438600 438600 438600> signif(438649, 4)[1] 438600 -- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._