[R] weird behaviour of summary.default

Prof Brian Ripley ripley at stats.ox.ac.uk
Mon Jun 12 14:58:54 CEST 2006


On Mon, 12 Jun 2006, Stefano Calza wrote:

> Hi all.
>
> I may missing something here, but if I do summary.default(1:9999), I get:
>
>   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
>      1    2500    5000    5000    7500    9999
>
>
> but if I do summary.default(1:10001) I get:
>
>   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
>      1    2501    5001    5001    7501   10000
>
> i.e. Max is rounded to 10000.
>
> What's wrong?

Nothing: you asked for it to be rounded.  Try reading the help page:

   digits: integer, used for number formatting with 'signif()' (for
           'summary.default') or 'format()' (for 'summary.data.frame').

and

> summary(1:10001, digits=7)
    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
       1    2501    5001    5001    7501   10001


-- 
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 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-help mailing list