[R] Weird options(digits=n) behaviour
Peter Dalgaard BSA
p.dalgaard at biostat.ku.dk
Thu Jan 30 01:14:03 CET 2003
Fernando Henrique Ferraz Pereira da Rosa <mentus at gmx.de> writes:
> > options(digits=4)
> [1] 6.053 2.641 -3.639 14.259 6.082
> [1] -0.03091 1.60310 -4.90588 5.07379 -0.04418
> > options(digits=2)
> [1] -0.031 1.603 -4.906 5.074 -0.044
> [1] 6.1 2.6 -3.6 14.3 6.1
> What is going on?
This is normal. digits=4 means that you need at least four significant
digits of the result. When you print vectors all values get printed in
the same format. Notice that in the second case -0.03091 has 4
significant digits and -0.04418 ditto and in the 3rd case likewise.
6.1 has two significant digits by the same conventions.
--
O__ ---- Peter Dalgaard Blegdamsvej 3
c/ /'_ --- Dept. of Biostatistics 2200 Cph. N
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
More information about the R-help
mailing list