title: plotting polygons inside loop in R, why this ambiguous behavior?
body: <p>So, I want to plot multiple polygons over one polygon using a loop in r. I have read that you need to use print in order to succesively display the polygons over the original polygon. However, that is not what R seems to do. Besides, in a hardly reproducible example, what i find is that either using print or not, the polygons will not plot within the loop. I am using a mac with OS monterrey, btw.</p>
  <p>Here is a reproducible example, using print gives a bunch of NULL messages, but does print, not using print still plots. Yet a more complicated example will never plot from within the loop despite plotting everything when i request line by line from within the loop.</p>
  <pre><code>require(maptools)
  data(wrld_simpl)
  
  plot(wrld_simpl)
  for (i in 1:12){
  region=wrld_simpl[wrld_simpl$NAME==wrld_simpl$NAME[i],]
   print(plot(region,border=&quot;red&quot;,add=T))
   } 
  </code></pre>