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

Description Usage Arguments Value Examples

View source: R/shapefiles.R

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

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## 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)
   )

## End(Not run)

Emaasit/ebolaCases documentation built on May 6, 2019, 3:46 p.m.