[R] significant figures in summary()

Uwe Ligges ligges at statistik.uni-dortmund.de
Thu Sep 13 19:46:16 CEST 2001


Andy Jacobson wrote:
> 
> Howdy,
> 
>         Should summary() print answers with different numbers of
>         significant figures, as in the following?
> 
> > dim(iv)
> [1] 3000    2
> > summary(iv)
>        X1                 X2
>  Min.   :-4.15261   Min.   :-3.271520
>  1st Qu.:-0.66188   1st Qu.:-0.671205
>  Median : 0.01233   Median :-0.008175
>  Mean   : 0.01121   Mean   : 0.016815
>  3rd Qu.: 0.67778   3rd Qu.: 0.715284
>  Max.   : 3.73594   Max.   : 3.691423
> > summary(iv[,1])
>     Min.  1st Qu.   Median     Mean  3rd Qu.     Max.
> -4.15300 -0.66190  0.01233  0.01121  0.67780  3.73600
> > summary(iv[,2])
>      Min.   1st Qu.    Median      Mean   3rd Qu.      Max.
> -3.272000 -0.671200 -0.008175  0.016820  0.715300  3.691000


I assume iv is a data.frame [summary.data.frame() will be used], while
iv[,i] are vectors [summary.default() will be used].

>From ?summary:
 summary.default(object, ..., digits = max(3, getOption("digits")-3))
 summary.data.frame(object, maxsum = 7,
                   digits = max(3, getOption("digits")-3), ...)


Without having changed the default of options("digits"), 
in summary() is digits = 7-3 (=4) in both cases.

Again from ?summary:
 digits - integer, used for number formatting with signif() 
          (for summary.default) 
          or format() (for summary.data.frame).

And that's the big difference! Have also a look at ?signif and ?format.

Uwe Ligges
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list