daily pastebin goal
79%
SHARE
TWEET

Untitled

a guest Aug 19th, 2018 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Is there a bug in `match' in R?
  2. > match(1.68, seq(0.01,10, by = .01))
  3. [1] 168
  4. > match(1.67, seq(0.01,10, by = .01))
  5. [1] NA
  6.    
  7. match(1.68, seq(1, 1000, by = 1)/100)
  8. # [1] 168
  9. match(1.67, seq(1, 1000, by = 1)/100)
  10. # [1] 167
  11.    
  12. match(1.6744, seq(1,1000, by = 1)/100)
  13. # [1] NA                               ## Just as I'd like it!
  14.    
  15. > findInterval(1.69, seq(0.01,10, by = .01))
  16. [1] 169
  17. > findInterval(1.69, seq(0.01,10, by = .01)-.0001)
  18. [1] 169
  19. > findInterval(1.68, seq(0.01,10, by = .01)-.0001)
  20. [1] 168
  21. > findInterval(1.67, seq(0.01,10, by = .01)-.0001)
  22. [1] 167
  23. > findInterval(1.66, seq(0.01,10, by = .01)-.0001)
  24. [1] 166
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top