title: R find nearest points in matrix
body: <p>R: finding line in matrix with points close to two selected points.</p>
  
  <p>I have a matrix with long/lat for an area.
  And I have a point in this area with a longitude and latitude, so I need to find the point in the matrix that is the best match.</p>
  
  <p>I have tried this, but it is not working:</p>
  
  <pre><code>find.point &lt;- is.numeric(which(abs(matrix[,1]-East)==min(abs(matrix[,1]-East))) 
                                 &amp;&amp; which(abs(matrix[,2]-North)==min(abs(matrix[,2]-North))))
  </code></pre>
  
  <p>How to find the point where East is closest to matrix[,1] and also North closest to matrix[,2]?</p>