[R] 2D look up (within interval)

YasirKaheil yasir.kaheil at ec.gc.ca
Thu Apr 29 19:58:21 CEST 2010

I have a matrix of X and Y coordinates, and one pair of coordinates that I
need to know it corresponds (or is closest) to which row in the matrix. For
MC<- cbind(rep(1:1000,each=1000),rep(1:1000,1000));

I know that if you do which.min you'll get the answer, which will be row #
542440, but which.min is slow and this process needs to be repeated a lot. 
I tried using match and findInterval and %in% but I don't know how I can use
them to find in 2 columns simultanuously.

Please help!

View this message in context: http://r.789695.n4.nabble.com/2D-look-up-within-interval-tp2075957p2075957.html
Sent from the R help mailing list archive at Nabble.com.

More information about the R-help mailing list