title: find number of points within a radius in R using lon and lat coordinates
body: <p>I have a set of points with longitude and latitude coordinates.
  I want to find out the number of points within a specific radius from each point.
  I have looked at the RANN and FNN packages and the only relevant function I found is the nn2() in the RANN package. though, I do not want to preset the maximum or minimum points that have to be identified (k variable in the nn2 function). in addition, even though I have tried several different values for k(number of points) and radius in nn2 I always get the same results. even when the radius is set to very small or zero.
  here's an example of the code I've used</p>
  
  <pre><code>points&lt;- nn2(mydata, k=100, radius = 0.02)
  </code></pre>
  
  <p>any ideas of how to do this in R?</p>