I am trying to check if values are present in a sequence of numbers using the %in% operator in R. The sequence is generated using the seq() function with a step of 0.01, ranging from 0.50 to 1.10.
Here are the different inputs I tried:
.55 %in% seq(.50, 1.1, by = .01)
.57 %in% seq(.50, 1.1, by = .01)
".55" %in% seq(.50, 1.1, by = .01)
".57" %in% seq(.50, 1.1, by = .01)
"0.55" %in% seq(.50, 1.1, by = .01)
"0.57" %in% seq(.50, 1.1, by = .01)
0.55 %in% seq(.50, 1.1, by = .01)
0.57 %in% seq(.50, 1.1, by = .01)
However, the outputs for these inputs are confusing and unexpected:
[1] TRUE
[1] FALSE
[1] FALSE
[1] FALSE
[1] TRUE
[1] TRUE
[1] TRUE
[1] FALSE
Does anyone know why .55 is recognized in the sequence, but .57 isn't?
How come when we add a leading zero and put quotes it returns TRUE?
How come quotes without a leading zero returns FALSE?