title: Find which points are within a given distance of each point
body: <p>I have a dataframe that has a list of places and their geographical locations in UTM (Universal Transverse Mercator) coordinates. </p>
  
  <p>It looks something like this:</p>
  
  <pre><code>Place    X_UTM   Y_UTM
      1 574262.0 6140492
      2 571251.2 6141669
      3 570841.9 6142535
      4 570233.8 6141213
      5 578269.2 6140304
      6 575067.1 6137444
  </code></pre>
  
  <p>I want to identify, for each Place (each row of the dataframe), which of the other places are within a given Euclidean distance. In this case, I want to find which places are closer than 1 kilometer. </p>
  
  <p>I've tried something like this:</p>
  
  <pre><code>foo &lt;- function(x, y) dist(c(x, y), method = "euclidian") &lt; 1000
  </code></pre>
  
  <p>which should be a function that returns the points that are closer than 1000 meters. Then:</p>
  
  <pre><code>x &lt;- lapply(df(,c(i, x, y)), FUN = foo)
  </code></pre>
  
  <p>where <code>i</code> is <code>"Place"</code>, <code>x</code> is <code>"X_UTM"</code> and <code>y</code> is <code>"Y_UTM"</code>. This do not work at all. </p>
  
  <p>The output I am after should look something like this (not obtained from the numbers given above):</p>
  
  <pre><code># Place Closest
  #     1    2, 5
  #     2       1
  #     3      NA
  #     4       5
  #     5    1, 4
  #     6      NA
  </code></pre>