[R] comparison operator, decimals, and signif()
Thomas Lumley
tlumley at u.washington.edu
Mon May 23 15:51:32 CEST 2005
On Sat, 21 May 2005, Nick Drew wrote:
>
> What does signif() do to my object called "testMean"
> so that the comparison now evaluates to TRUE?
>
>> signif(testMean, 3) == 82.9
> [1] TRUE
>
It rounds to 3 significant digits.
An even more reliable approach is
round(testMean*10) == 829
since 829 is an integer and exactly representable.
-thomas
More information about the R-help
mailing list