5</span><span class="op">)</span></span>
<span><span class="op">}</span></span></code></pre></div>
<pre><code><span><span class="co">##    user  system elapsed </span></span>
<span><span class="co">##  0.0710  0.0000  0.0715</span></span></code></pre>
<p>Alternatively, spherical distances can be used with
<code>dwithin=FALSE</code> and <code><a href="https://r-spatial.github.io/s2/reference/s2_closest_feature.html" class="external-link">s2::s2_closest_edges()</a></code>;
although running in similar time, <c