[R] Weird options(digits=n) behaviour

Douglas Bates bates at stat.wisc.edu
Thu Jan 30 00:48:03 CET 2003


Fernando Henrique Ferraz Pereira da Rosa <mentus at gmx.de> writes:

>      I noticed some very weird behaviour of the function: options(digits=n),
> where n is the number of digits you would expect to get in R calculations.
>      Let's take a example:
> 
> > options(digits=4)
> > getdata(caso.pool.k3.r3.e2)
> [1]  6.053  2.641 -3.639 14.259  6.082
> 
>      Which works fine... now, trying again, with different data:
> 
> > options(digits=4)
> > getdata(controle.pool.k3.r3.e2)
> [1] -0.03091  1.60310 -4.90588  5.07379 -0.04418
> >
>     Which gives me 6 digits instead of 6. If I try digits=2, it then works
> with this data:

The 'digits' option sets the minimum number of significant digits.
Some values in that array are printed to 6 significant digits but the
first and last have only 4 significant digits.




More information about the R-help mailing list