[R] Why is options(digits = 1) displays two digits?

Tal Galili tal.galili at gmail.com
Tue Mar 21 10:30:33 CET 2017


This may have been asked before, but I don't understand the behavior
of options(digits = 1) for vectors containing values such as 0.01

For example, why is this happening:
options(digits = 1)
> 0.01
[1] 0.01


More examples:
> options(digits = 7)
> 0.1
[1] 0.1
> 0.01
[1] 0.01
> 0.11
[1] 0.11
> c(0.1,0.01)
[1] 0.10 0.01
> options(digits = 1)
> 0.1
[1] 0.1
> 0.01
[1] 0.01
> 0.11
[1] 0.1
> c(0.1,0.01)
[1] 0.10 0.01
>

The help file in ?options says:
digits:
controls the number of digits to print when printing numeric values. It is
a suggestion only.


Is this what is mean by "It is a suggestion only." ?

	[[alternative HTML version deleted]]



More information about the R-help mailing list