Learn R Programming

eechidna (version 0.1)

getElectorateShapes: Extract shapefiles (of Australian electorates) from shp file

Description

Extract polygon information and demographics for each of Australia's electorates. The map and data corresponding to the shapefiles of the 2013 Australian electorates (available at http://www.aec.gov.au/Electorates/gis/gis_datadownload.htm) are part of this package as nat_map.rda and nat_data.rda in the data folder. The function will take several minutes to complete.

Usage

getElectorateShapes(shapeFile, keep = 0.05)

Arguments

shapeFile
path to the shp file
keep
percent of polygon points to keep, the default is set to 5%.

Value

list with two data frames: map and data; `map` is a data set with geographic latitude and longitude, and a grouping variable to define each entity. The `data` data set consists of demographic or geographic information for each electorate, such as size in square kilometers or corresponding state. Additionally, geographic latitude and longitude of the electorate's centroid are added.

Examples

Run this code
## Not run: ------------------------------------
# url <- "national-esri-16122011/COM20111216_ELB_region.shp"
# electorates <- getElectorateShapes(url)
# library(ggplot2)
# ggplot(data=electorates$data) + 
#    geom_map(aes(fill=AREA_SQKM, map_id=id), map=electorates$map) + 
#    expand_limits(
#      x=range(electorates$map$long), 
#      y=range(electorates$map$lat)
#    )
## ---------------------------------------------

Run the code above in your browser using DataLab