I think I needed to rephrase my terribly worded previous question (deleted it). Here is another try. I want to join the neighboring regions so that their common border disappears, and only their outer line can be seen.
Here's a reproducible example:
require(shapefiles)
require(sp)
xx <- readShapeSpatial(system.file("shapes/sids.shp", package="maptools")[1],
IDvar="FIPSNO", proj4string=CRS("+proj=longlat +ellps=clrk66"))
plot(xx)

Now we consider only the areas of regions 3 and 5
plot(xx[c(3,5),])
How can I just fill in these regions. In practice, what I want to do is that the map of the entire continent shows all countries and creates a map showing North America and South America.
For me, this seems like a fairly general task, but I still can not find the desired function. I just missed a function or can I just manually do it?

source
share