Calculate a distance between two points having lat, long and elevation in R : <p>Is there a package which allows to compute the spatial distance between two points taking into account the elevation. So for each point, we would have latitude, longitude and elevation. So far, I had to write the following function:</p>

<pre><code>library(geosphere)  
distance3D &lt;- function (point1, point2) {
      planiDist &lt;- distm(point1[1:2], point2[1:2])
      altiDist &lt;- point2[3] - point1[3]
      dist3D &lt;- sqrt(planiDist^2+altiDist^2)
      return(dist3D)
    }
</code></pre>

<p>I was just wondering if one function existed in one of the R packages.</p>
