# [Rd] digits in summary.default

From: Simone Giannerini <sgiannerini_at_gmail.com>
Date: Thu 14 Sep 2006 - 09:14:51 GMT

Dear all,

the number of significant digits in summary default is

digits = max(3, getOption("digits") - 3)

on my platform this results to be 4. The point is that if you have, say, integer data of magnitude greater than 10^3 the command summary will produce heavily rounded results.
A simple example follow:

> x

[1] 123456 234567 345678

> summary(x)

Min. 1st Qu. Median Mean 3rd Qu. Max.  123500 179000 234600 234600 290100 345700

# quite different from

> quantile(x)

0% 25% 50% 75% 100% 123456.0 179011.5 234567.0 290122.5 345678.0

Is it possible to adapt the number of significant digits to the magnitude of the data?
The first thing that comes into my mind is digits = nchar(trunc(max(x))) #

If it is not possible then I think it would be nice to mention the issue in the documentation.

Thanks for the attention,

Simone

> R.version

```               _
platform       i386-pc-mingw32
arch           i386
os             mingw32
system         i386, mingw32
status
major          2
minor          3.1
year           2006
month          06
day            01
svn rev        38247
language       R
```

version.string Version 2.3.1 (2006-06-01)

> Sys.getlocale()

[1] "LC_COLLATE=English_United States.1252;LC_CTYPE=English_United States.1252;LC_MONETARY=English_United
States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252"
>

Simone Giannerini
Dipartimento di Scienze Statistiche "Paolo Fortunati" Universita' di Bologna
Via delle belle arti 41 - 40126 Bologna, ITALY Tel: +39 051 2098262 Fax: +39 051 232153

R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Thu Sep 14 19:16:46 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Fri 15 Sep 2006 - 08:30:07 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.