Hi,
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
example:
MC<- cbind(rep(1:1000,each=1000),rep(1:1000,1000));
p<-c(543.1,440.05);

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!
Thanks!

-- 
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.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to