Plot only outer border in ggplot2 map / geom_polygon
<p>I would like to plot only the outer boundaries of the <code>ethnic</code> variable in <a href="https://dl.dropboxusercontent.com/u/3178480/plot_data.rdata" rel="nofollow noreferrer">this data set</a>. The data set <code>plot_data</code> that you find under this link is a fortified data set from a shapefile from <a href="http://grid.prio.org" rel="nofollow noreferrer">PRIO GRID</a> for Sudan. </p>

<p>My current code looks like this:</p>

<pre><code>plot_data &lt;- load("plot_data.rdata")

ggplot(plot_data, 
       aes(x= long, 
           y = lat, 
           group = id)) + 
  geom_polygon() + 
  geom_polygon(data = plot_data %&gt;% 
                 filter(!is.na(ethnic)) %&gt;% # subset data with ethnicity only
                 as.data.frame(), 
               aes(color = ethnic)) + 
  coord_equal() 
</code></pre>

<p>This gives me the following output:</p>

<p><a href="https://i.stack.imgur.com/RhYHO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RhYHO.png" alt="enter image description here"></a></p>

<p>However, I would like to remove all interior lines of the settlement area of the specified ethnic group and plot only the outer border of the area. </p>

<p>I didn't get the solution for <a href="https://stackoverflow.com/questions/31847671/remove-us-state-borders-create-outlined-regions-in-ggplot2-geom-polygon">this similar problem</a> to work. </p>

<p>I might need to combine the cells <em>before</em> I fortify the shapefile; but maybe there is a way after fortifying. I've tried to remove duplicate coordinates, but that didn't work. Any suggestions would be greatly appreciated. Thanks.</p>