Create high quality maps that may be shaded or projected in a variety of ways. While today’s post just covers generating a basic map, additional arguments may be used for coloring in counties, states, or countries (col, fill), looking at different map projections (projection), among many many other options.
- database – Usually one of four databases: "world", "usa", "state", "county". More databases are available.
- regions – By default, all regions in the database will be generated. However, specific regions for plotting may be specified using a vector of character strings.
Example. I generate a world map, a map of the USA, and a map containing only MN, ND, and SD. I also included a copy of the last map generated in the help file’s example code for the map function, which shows the unemployment rate in the US in each county in 2009. This last map gives a nice view into the real benefits of using the maps package.
> > #install.packages("maps") > library(maps) > > png("map_1world.png") > map() > dev.off() null device 1 > > png("map_2states.png") > map("state") > dev.off() null device 1 > > png("map_3MNNDSD.png") > MNNDSD <- c("minnesota", "north dakota", "south dakota") > map("state", MNNDSD) > dev.off() null device 1 >