 href="https://r-spatial.github.io/sf/reference/geos_unary.html" class="external-link">st_centroid()</a></code> to get the
centroids, using the <code>of_largest_polygon=TRUE</code> argument to
make sure that the centroid is that of the largest polygon id the
observation is made up of more than one external ring:</p>
<div class="sourceCode" id="cb30"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="va">NY8_ct_sf</span> <span class="op">&lt;-</span> <span class="fu"><a href="ht