[Rd] digits in summary.default
Simone Giannerini
sgiannerini at gmail.com
Thu Sep 14 11:14:51 CEST 2006
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 <- c(123456,234567,345678)
> 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
More information about the R-devel
mailing list