[R] Help with which()
Ben Bolker
bolker at ufl.edu
Thu Jul 24 18:30:12 CEST 2008
Erik Iverson <iverson <at> biostat.wisc.edu> writes:
>
> See
>
>
http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-doesn_0027t-R-think-these-numbers-are-equal_003f
>
> naw3 <at> duke.edu wrote:
> > I'm using which to find the position of a value in my data table
[snip]
> For example, when I do:
> >
> > where1<-which(Operons==3573.1,arr.ind=TRUE)
> >
> > it returns the position of that number and of 3573.15.
> >
This doesn't seem like the same issue as the FAQ.
If there are really two elements in the array, one of
which is 3573.1 and the other of which is 3573.15, they
should not be treated as equal. Something else is going on.
Could the original poster please send a small reproducible
example?
> Operons = matrix(c(3573.1,0,0,0,3573.15,0),ncol=2)
> which(Operons==3573.1,arr.ind=TRUE)
row col
[1,] 1 1
Ben Bolker
More information about the R-help
mailing list