I create a numeric sequence from 0 to 20 by 0.1 units but which() cannot find 15.1 even though it is in the data. But if I join to sequences which() finds it.
a=NULL
a=as.numeric(c(seq(from=0,to=20,by=0.1)))
dat=as.data.frame(a)
which(dat$a==19.8)
which(dat$a==15.1) ## does not work!!! why?
which(dat$a==15.2) ## does not work!!! why?
which(dat$a==15.3)
## but if I start from 15 it works
a=NULL
a=as.numeric(c(seq(from=15,to=20,by=0.1)))
dat=as.data.frame(a)
which(dat$a==19.8)
which(dat$a==15.1)
## or if I join to sequences it works
a=as.numeric(c(seq(from=0,to=14.9,by=0.1)))
b=as.numeric(c(seq(from=15,to=20,by=0.1)))
c=c(a,b)
dat=as.data.frame(c)
which(dat$c==19.8)
which(dat$c==15.1)