title: How to select a value according to their spatial position?
body: <p>I would like to display the name of the countries in the center of each of those present on the output map. Is this possible directly from the <code>word</code> variable?</p>
  <pre><code>library(sp)
  
  names(world)
  
  saudi = world[world$name_long == &quot;Saudi Arabia&quot;, ]
  plot(st_geometry(saudi), expandBB = c(0, 0.2, 0.1, 1), col = &quot;gray&quot;, lwd = 2)
  plot(world[0], add = TRUE)
  </code></pre>
  <p><a href="https://i.stack.imgur.com/CgQUf.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CgQUf.png" alt="enter image description here" /></a></p>
  <p>I would just like this case:</p>
  <p><a href="https://i.stack.imgur.com/yB6ZE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yB6ZE.png" alt="enter image description here" /></a></p>