title: Shrink sf polygon by fixed distance
body: <p>I am trying to shrink an sf polygon by a fixed distance.</p>
  <p>Take this simple polygon:</p>
  <pre><code>coords &lt;- list(rbind(c(0,0), c(2,0), c(2,2), c(1,2), c(1,1), c(0,1), c(0,0)))
  p &lt;- sf::st_polygon(x = coords)
  ggplot() + geom_sf(data = p,  fill = &quot;white&quot;, color = &quot;black&quot;)
  </code></pre>
  <p><a href="https://i.stack.imgur.com/rwi4B.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rwi4B.png" alt="enter image description here" /></a></p>
  <p>I want to make a polygon of the same shape, but with edges all exactly 0.1 units away from the original polygon. This is the target:</p>
  <pre><code>target.coords &lt;- list(rbind(c(0.1,0.1), c(1.9,0.1), c(1.9,1.9), c(1.1,1.9), c(1.1,0.9), c(0.1,0.9), c(0.1,0.1)))
  target &lt;- sf::st_polygon(x = target.coords)
  ggplot() + 
    geom_sf(data = p,  fill = &quot;white&quot;, color = &quot;black&quot;) +
    geom_sf(data = target,  fill = &quot;green&quot;, color = &quot;dark green&quot;)
  </code></pre>
  <p><a href="https://i.stack.imgur.com/kNhct.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kNhct.png" alt="enter image description here" /></a></p>
  <p>I thought that <code>sf::st_buffer()</code> would get me there, but the outside corner doesn't quite match.</p>
  <pre><code>p1 &lt;- sf::st_buffer(x = p, dist = -0.1)
  ggplot() +
    geom_sf(data = p,  fill = &quot;white&quot;, color = &quot;black&quot;) + 
    geom_sf(data = p1, fill = &quot;red&quot;,   color = &quot;dark red&quot;)
  </code></pre>
  <p><a href="https://i.stack.imgur.com/PAsnx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PAsnx.png" alt="enter image description here" /></a></p>
  <p>Is there an alternative setting to <code>sf::st_buffer()</code> that would allow me to achieve the target polygon? Or is there an alternative function that would achieve this? The offset needs to be by a fixed distance, not by shrinking the polygon a relative amount (e.g. 90%).</p>