0

How is this possible, and how can I find out the difference?

> a$a
 [1] 7.849803 7.526553 7.639534 7.922609 8.004963 8.607438 7.610484 7.558173        7.718382 7.737507 7.398546 7.932555
[13] 7.473627 7.644294 7.519430 7.878465
> b$b
 [1] 7.849803 7.526553 7.639534 7.922609 8.004963 8.607438 7.610484 7.558173     7.718382 7.737507 7.398546 7.932555
[13] 7.473627 7.644294 7.519430 7.878465
> a$a == b$b
 [1]  TRUE  TRUE FALSE FALSE  TRUE  TRUE FALSE FALSE  TRUE FALSE  TRUE  TRUE      TRUE  TRUE FALSE  TRUE
variable
  • 1,013
  • 1
  • 12
  • 29
  • Almost certainly either a duplicate of [this](http://stackoverflow.com/q/9508518/324364) or simply an issue of the number of digits being displayed vs actual digits (`options(digits = 22)`). – joran Feb 21 '17 at 20:17
  • You need to read up on numerical accuracy. (This is most likely discussed in the R FAQ.) – IRTFM Feb 21 '17 at 20:17
  • @variable. If the linked duplicate does not solve your problem, let me know and I'll open it up. – lmo Feb 21 '17 at 20:17
  • It smells like a floating point accuracy problem, like : `identical(0.1+0.1+0.1, 0.3)` – digEmAll Feb 21 '17 at 20:17
  • 1
    Yes that's what it was. print(a$a, digits=18) and print(b$b, digits=18) showed the problem. – variable Feb 21 '17 at 21:26

0 Answers0