[R] matching on multiple minimums

Barry Taylor barrystaylor at yahoo.com
Thu Oct 28 16:14:51 CEST 2004


I was wondering if someone has witnessed the following
behavior with matching on multiple minimums in a

If I manually create a vector of doubles:
test <- c(2.33,11.09,0.02,,6.41)

I can then run any of the following to retrieve the
indices of the minimum values (3 and 4 in this case),
of which there are two (done purposefully):

match(test,min(test)) # to see the entire vector

However, my problem is as follows. I am not manually
creating a vector to test for multiple minimums but
rather doing a read.table on a file that contains the
same data with other columns, etc. I then trim off the
data from that matrix (there are several identical
ways to do this):

unlist(myMatrix[1], use.name=FALSE)

But, running any of the tests listed above only
returns the index of the last minimum. Both my manual
vector and vector culled from the matrix appear to me
to be identical (tested with is.vector, is.numeric,
is.double, etc), but it will only every return the
index of the second of the two minimums. Any help
would be truly appreciated.


More information about the R-help mailing list