title: Calculating the distance between polygon and point in R
body: <p>I have a, not necessarily convex, polygon without intersections and a point outside this polygon. I'm wondering how calculate the Euclidian distance most efficiently in a 2-dimensional space. Is there a standard method in <code>R</code>?</p>
  
  <p>My first idea was to calculate the minimum distance of all the lines of the polygon (extended infinitely so they are line, not line pieces) and then calculate the distance from the point to each individual line using the start of the line piece and Pythagoras.</p>
  
  <p>Do you know about a package that implements an efficient algorithm?</p>