[R] equality of values

Sarah Goslee sarah.goslee at gmail.com
Sun Jun 24 23:29:06 CEST 2012


Please read R FAQ 7.31, Why doesn't R think these numbers are equal?

Sarah

On Sun, Jun 24, 2012 at 1:58 PM, Andreia Leite
<andreiaheitorleite at gmail.com> wrote:
> Dear list,
>
> I'm trying to do a loop where I should choose a cell of a data frame
> comparing it with another. The code actually works for the majority of the
> loop but for some reason it doesn't and I can't figure out why.
>
> When I tried to understand why I've noticed this:
>
>> dif[11]
> [1] 118.8333
>> linhasUpdate[10,6]
> [1] 118.8333
>> dif[11]==linhasUpdate[10,6]
> [1] FALSE
>
> Even though the values are the same R says they aren't! This happens for
> some of the values (44) and for the others (128) it works fine.
>
> Does anybody why is this happening or a way to fix it? I' using 2.15.0.
>
> Thanks a lot!
>
> Andreia Leite
>
> --
-- 
Sarah Goslee
http://www.functionaldiversity.org



More information about the R-help mailing list