title: How to find the closest lat and long in a text file?
body: <p>I have a text file contains information as follows:</p>
  
  <pre><code>   Grid Point Index, Latitude, Longitude, Cell
   167,    0.000000,    9.432301, 1350
   169,    0.000000,    9.544590, 1350
   171,    0.000000,    9.656878, 1350
   173,    0.000000,    9.769168, 1350
   175,    0.000000,    9.881457, 1350
   177,    0.000000,    9.993747, 1350
   179,    0.000000,   10.106036, 1386
   181,    0.000000,   10.218326, 1386
  </code></pre>
  
  <p>I would like to find out the corresponding Grid point and cell for this lat and long
  :0.000000,   11.902665.
  well, I can do it manually  but this will take lots of the time.
  It is sure that there is no exact coordinate corresponds to my input, so I want the closest ones in the file to the input.
  Can anybody help me to build this function</p>
  
  <pre><code>   insert lat and long
  </code></pre>
  
  <p>then will find the closest lat-long in the file and the corresponding grid point index  and cell</p>
  
  <p>to read the file</p>
  
  <pre><code>      das= read.table("C:\\Users\\lonlatnter.txt", sep=",",header=TRUE)
  </code></pre>