title: Evaluating the closest distance from one point between multiple options?
body: <p>I have a set of longitude/latitude points in a data frame called <code>person_location</code></p>
  
  <pre><code>+----+-----------+-----------+
  | id | longitude | latitude  |
  +----+-----------+-----------+
  |  1 | -76.67707 | 39.399754 |
  |  2 | -76.44519 | 39.285084 |
  |  3 | -76.69402 |  39.36958 |
  |  4 | -76.68936 | 39.369907 |
  |  5 | -76.58341 | 39.357994 |
  +----+-----------+-----------+
  </code></pre>
  
  <p>I then have another set of longitude and latitude points in a data frame called <code>building_location</code>:</p>
  
  <pre><code>+----+------------+-----------+
  | id | longitude  | latitude  |
  +----+------------+-----------+
  |  1 | -76.624393 | 39.246464 |
  |  2 | -76.457246 | 39.336996 |
  |  3 | -76.711729 | 39.242936 |
  |  4 | -76.631249 | 39.289103 |
  |  5 | -76.566742 | 39.286271 |
  |  6 | -76.683106 |  39.35447 |
  |  7 | -76.530232 | 39.332398 |
  |  8 | -76.598582 | 39.344642 |
  |  9 | -76.691287 | 39.292849 |
  +----+------------+-----------+
  </code></pre>
  
  <p>What I'm trying to do is calculate for each ID within <code>person_location</code>, what the closest ID is within <code>building_location</code>. I know how to calculate the difference between two separate points using the <code>distHaversine</code> function from <code>library(geosphere)</code>, but how would I get it to evaluate the closest distance from one point to a <em>set of multiple points</em>?</p>