use spatially indexed points and
<code><a href="https://r-spatial.github.io/s2/reference/s2_closest_feature.html" class="external-link">s2::s2_closest_edges()</a></code> (see <a href="https://github.com/r-spatial/s2/issues/125#issuecomment-860107442" class="external-link uri">https://github.com/r-spatial/s2/issues/125#issuecomment-860107442</a>)</p>
<div class="sourceCode" id="cb53"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="op">(</span><span class="va">old_use_s2</span