Created
June 24, 2011 17:15
-
-
Save 1beb/1045230 to your computer and use it in GitHub Desktop.
Part IIV: ggplot2 Introduction Mapping Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## Title: ggplot2 Introduction: Plotting Maps | |
| ## Description: This line by line analysis, provides an introduction to ggplot2. Mapping. | |
| ## Created by: Brandon Bertelsen: Research Manager, Credo Consulting Inc. | |
| # install.packages(maptools) | |
| library(maptools) | |
| library(ggplot2) | |
| # Must allow for licensing | |
| gpclibPermit() | |
| # Fedoral Electoral Districts Courtesy of http://geobase.ca/geobase/en/data/admin/fed/description.html | |
| shape<-readShapeSpatial("R:/root/dev/ggplot2 Introduction/fed308_a.shp") | |
| # Fortify | |
| x <- fortify(shape, region="FED_NUM") | |
| # Subset holes | |
| ggplot(x, aes(long, lat)) + geom_path() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment