ggplot2 is awesome! I especially love how pretty and neat maps look. Unfortunately, ggplot2 is still left outside of most intro to stats classrooms... So, in collaboration with Prof. Randy Pruim (Calvin College), I developed a few functions that use ggplot2 to create country-level and US state-level maps very easily. These functions have now been integrated in the MOSAIC R package, often used in intro classes. You can install the newest version of MOSAIC directly from CRAN.
Here's the main idea: say you have a dataset, called women, that starts like this (this is actual data -- see the note at the end of the page for a link):
|District of Columbia||287057||160809||71623||28605|
After installing and loading mosaic, you only need one line of code to produce the following plot:
mUSMap(data=women, key="state", fill="log(f_divorced)")
Would you prefer to see Alaska and Hawaii in their proper places:
mUSMap(data=women, key="state", fill="log(f_divorced)", style="real")
A similar function ( mWorldMap() ) exists to make country-level data.
For more information about MOSAIC, visit the documentation and vignettes. If you are interested in a step by step document that goes over the map capabilities of MOSAIC, you might find this useful. It was written assuming very little familiarity with R, and so it is suitable for absolute beginners and intro students. If you want to follow along you will need these data files.