davidwood
2013-Mar-01 03:30 UTC
[R] Returning index of vector element matching specific value
Thanks for the reply AK.>From R FAQ 7.31: "The only numbers that can be represented exactly in R'snumeric type are integers and fractions whose denominator is a power of 2" I'm not sure though that this is the problem here, does this statement apply to only floating point numbers? Is 0.15 a floating point number? Also the dummy code I provided above works for 0.1, which is 1/10, but not 0.15, which is 3/20, yet neither of these fractions has a denominator that is a power of 2, of if FAQ 7.31 is to be read literally, neither of these fractions can be accurately represented yet one still works in the test. I will cast the vector to character and go on from there - but it would be great if I could understand this a bit more. Cheers, Dave -- View this message in context: http://r.789695.n4.nabble.com/Returning-index-of-vector-element-matching-specific-value-tp4659952p4659955.html Sent from the R help mailing list archive at Nabble.com.
davidwood
2013-Mar-01 05:16 UTC
[R] Returning index of vector element matching specific value
Thanks very much AK so indeed they are floats! I'll be more careful next time when performing equality comparisons. Cheers, Dave -- View this message in context: http://r.789695.n4.nabble.com/Returning-index-of-vector-element-matching-specific-value-tp4659952p4659959.html Sent from the R help mailing list archive at Nabble.com.