I can create a county map using ggplot. I would like to use this map data, and map new boundaries that are aggregates of counties. For example, an equivalent task to mine would be to map state boundaries ("region" variable), rather than county boundaries, using this county map dataset (I have another variable I would use to aggregate counties).
Simply changing the group in ggplot does not work for this. I believe I might need to create new polygon shapes based on the variable I am using to aggregate, but I am not sure. Any thoughts on how I can do this? Any help is greatly appreciated!
library(ggplot2)
# load county map data
m.county <- map_data("county")
head(m.county)
long lat group order region subregion
1 -86.50517 32.34920 1 1 alabama autauga
2 -86.53382 32.35493 1 2 alabama autauga
3 -86.54527 32.36639 1 3 alabama autauga
4 -86.55673 32.37785 1 4 alabama autauga
5 -86.57966 32.38357 1 5 alabama autauga
6 -86.59111 32.37785 1 6 alabama autauga
# map county data with county borders
ggplot(data = m.county) +
geom_polygon(aes(x=long, y=lat,group=group))