Re: [R] comparison operator, decimals, and signif()

From: Thomas Lumley <tlumley_at_u.washington.edu>
Date: Mon 23 May 2005 - 23:51:32 EST

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



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Mon May 23 23:55:58 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:32:00 EST