| Type: | Package | 
| Title: | Tools for Plotting Canadian Choropleth Maps and Choropleth Alternatives | 
| Version: | 0.0.1 | 
| Maintainer: | Andrew McCormack <mccormack.andy@gmail.com> | 
| Description: | A variety of functions that make it easy to plot standard choropleth maps as well as choropleth alternatives in 'ggplot2'. | 
| License: | MIT + file LICENSE | 
| Encoding: | UTF-8 | 
| LazyData: | true | 
| Depends: | R (≥ 2.10) | 
| RoxygenNote: | 6.1.1 | 
| Imports: | dplyr, ggplot2, magrittr | 
| Suggests: | knitr | 
| VignetteBuilder: | knitr | 
| NeedsCompilation: | no | 
| Packaged: | 2019-05-08 14:49:26 UTC; andrewmccormack | 
| Author: | Andrew McCormack [aut, cre], Aaron Erlich [aut] | 
| Repository: | CRAN | 
| Date/Publication: | 2019-05-09 14:30:03 UTC | 
Pipe operator
Description
See magrittr::%>% for details.
Usage
lhs %>% rhs
Census divisions (2016)
Description
A data set with geographic information for Canadian census divisions
Usage
census_divisions_2016
Format
A data.frame with 91430 rows and 13 variables:
- long
- Longitude 
- lat
- Latitude 
- order
- Order of layers 
- hole
- Polygon hole (TRUE or FALSE) 
- piece
- Piece 
- id
- Uniquely identifies a census division (composed of the 2-digit province/territory unique identifier followed by the 2-digit census division code). 
- group
- Group 
- census_division_name
- Census division name 
- census_divison_type
- Census division type 
- pr_alpha
- Province or territory 2-letter identifier 
- pr_sgc_code
- Province Standard Geographical Classification (SGC) code. 
- pr_english
- Province name (English) 
- pr_french
- Province name (French) 
Source
https://www12.statcan.gc.ca/census-recensement/2011/geo/bound-limit/bound-limit-2016-eng.cfm (under Statistics Canada Open Licence https://www.statcan.gc.ca/eng/reference/licence)
Census divisions cartogram data frame (territories included) (2016)
Description
A data set with geographic information for Canadian census divisions, census boundary divisions distorted by population size, territories included
Usage
census_divisions_2016_carto
Format
A data.frame with 57513 rows and 18 variables:
- long
- Longitude 
- lat
- Latitude 
- order
- Order of layers 
- hole
- Polygon hole (TRUE or FALSE) 
- piece
- Piece 
- census_code
- Uniquely identifies a census division (composed of the 2-digit province/territory unique identifier followed by the 2-digit census division code). 
- group
- Group 
- census_division_name
- Census division name 
- census_divison_type
- Census division type 
- pr_sgc_code
- Province Standard Geographical Classification (SGC) code. 
- population_2016
- Population of census division in 2016 
- population_density_2016
- Population density (individuals per square kilometer) in 2016 
- land_area_2016
- Land area of census division 
- population_2011
- Population of census division in 2011 
- pr_alpha
- Province or territory 2-letter identifier 
- pr_english
- Province name (English) 
- pr_french
- Province name (French) 
Source
https://www12.statcan.gc.ca/census-recensement/2011/geo/bound-limit/bound-limit-2016-eng.cfm (under Statistics Canada Open Licence https://www.statcan.gc.ca/eng/reference/licence)
Census divisions cartogram data frame (territories excluded) (2016)
Description
A data set with geographic information for Canadian census divisions, census boundary divisions distorted by population size, territories excluded
Usage
census_divisions_2016_noterr_carto
Format
A data.frame with 35410 rows and 18 variables:
- long
- Longitude 
- lat
- Latitude 
- order
- Order of layers 
- hole
- Polygon hole (TRUE or FALSE) 
- piece
- Piece 
- census_code
- Uniquely identifies a census division (composed of the 2-digit province/territory unique identifier followed by the 2-digit census division code). 
- group
- Group 
- census_division_name
- Census division name 
- census_divison_type
- Census division type 
- pr_sgc_code
- Province Standard Geographical Classification (SGC) code. 
- population_2016
- Population of census division in 2016 
- population_2016
- Population density (individuals per square kilometer) in 2016 
- land_area_2016
- Land area of census division 
- population_2011
- Population of census division in 2011 
- pr_alpha
- Province or territory 2-letter identifier 
- pr_english
- Province name (English) 
- pr_french
- Province name (French) 
Source
https://www12.statcan.gc.ca/census-recensement/2011/geo/bound-limit/bound-limit-2016-eng.cfm (under Statistics Canada Open Licence https://www.statcan.gc.ca/eng/reference/licence)
Census division population data for 2011 and 2016
Description
A data set with population data at the census level for 2011 and 2016
Usage
census_pop2016
Format
A data.frame with 293 rows and 11 variables:
- census_division_code
- Uniquely identifies a census division (composed of the 2-digit province/territory unique identifier followed by the 2-digit census division code). 
- census_division_name
- Census division name 
- census_divison_type
- Census division type 
- pr_sgc_code
- Province Standard Geographical Classification (SGC) code. 
- pr_english
- Province or territory name (English). 
- population_2016
- 2016 Population of Province 
- population_density_2016
- Population density (individuals per square kilometer) in 2016 
- land_area_2016
- Land area of census division 
- population_2011
- 2011 Population of Province 
- pr_alpha
- Province or territory 2-letter identifier 
- pr_french
- Province or territory name (French). 
Source
https://www12.statcan.gc.ca/census-recensement/2016/dp-pd/hlt-fst/pd-pl/comprehensive.cfm, (under Statistics Canada Open Licence https://www.statcan.gc.ca/eng/reference/licence)
Canadian federal election results data
Description
A data set with information on Canadian federal election results, dating back to 1997
Usage
federal_election_results
Format
A data.frame with 37111 rows and 12 variables:
- riding_name_english
- Federal electoral district name in English. 
- riding_name_french
- Federal electoral district name in French. 
- riding_code
- Uniquely identifies a federal electoral district (composed of the 2-digit province/territory unique identifier followed by the 3-digit federal electoral district code). 
- pr
- Province or territory name (English and French). 
- population
- Population of federal riding. 
- voter_turnout
- Voter turnout 
- candidate
- Name of winning candidate 
- election_year
- Year of election (1997, 2000, 2004, 2006, 2008, 2011, and 2015 election included.) 
- party
- Winning party in riding 
- pr_alpha
- Province or territory 2-letter identifier 
- pr_french
- Province or territory name (French). 
- pr_english
- Province or territory name (English). 
- pr_sgc_code
- Province Standard Geographical Classification (SGC) code. 
Source
http://www.elections.ca/content.aspx?section=ele&dir=pas&document=index&lang=e, (under Open Government Licence https://open.canada.ca/en/open-government-licence-canada)
Canadian federal riding bins (used for tile plots)
Description
A data set with coordinates for the mapcan::riding_binplot() function.
Usage
federal_riding_bins
Format
A data.frame with 944 rows and 8 variables:
- y
- y-axis of riding bins (corresponds to longitude) 
- x
- x-axis of riding bins (corresponds to latitude) 
- pr_alpha
- Province or territory 2-letter identifier 
- representation_order
- Representation order. Specifies boundaries/number of seats for a given election (e.g. the 2015 election used the 2013 representation order, with 338 seats). 
- pr_french
- Province or territory name (French). 
- pr_english
- Province or territory name (English). 
- pr_sgc_code
- Province Standard Geographical Classification (SGC) code. 
- riding_code
- Uniquely identifies a federal electoral district (composed of the 2-digit province/territory unique identifier followed by the 3-digit federal electoral district code). 
Canadian federal riding hexagons (used for hexagonal tile plots)
Description
A data set with coordinates for the mapcan::riding_binplot() function.
Usage
federal_riding_hexagons
Format
A data.frame with 6629 rows and 15 variables:
- long
- y-axis of riding hexagons 
- lat
- x-axis of riding hexagons 
- order
- Order of layers 
- hole
- Polygon hole (TRUE or FALSE) 
- piece
- Piece 
- group
- Group 
- representation_order
- Representation order. Specifies boundaries/seats for a given election (e.g. the 2015 election used the 2013 representation order, with 338 seats). 
- pr_french
- Province or territory name (French). 
- pr_english
- Province or territory name (English). 
- pr_sgc_code
- Province Standard Geographical Classification (SGC) code. 
- riding_code
- Uniquely identifies a federal electoral district (composed of the 2-digit province/territory unique identifier followed by the 3-digit federal electoral district code). 
Federal ridings
Description
A data set with geographic information for Canadian federal ridings (2013 representation order)
Usage
federal_ridings
Format
A data.frame with 46830 rows and 15 variables:
- long
- Longitude 
- lat
- Latitude 
- order
- Order of layers 
- hole
- Polygon hole (TRUE or FALSE) 
- piece
- Piece 
- riding_code
- Uniquely identifies a federal electoral district (composed of the 2-digit province/territory unique identifier followed by the 3-digit federal electoral district code). 
- group
- Group 
- riding_name_english
- Federal electoral district name in English. 
- riding_name_french
- Federal electoral district name in French. 
- province_sgc_code
- Province Standard Geographical Classification (SGC) code 
- pr_english
- Province name (English) 
- pr_french
- Province name (French) 
- pr_alpha
- Province or territory 2-letter identifier 
Source
https://www12.statcan.gc.ca/census-recensement/2011/geo/bound-limit/bound-limit-2016-eng.cfm, (under Statistics Canada Open Licence https://www.statcan.gc.ca/eng/reference/licence)
Canadian maps function
Description
A function that returns a data frame with map data, for use in ggplot.
Usage
mapcan(boundaries, type, province = all, territories = TRUE)
Arguments
| boundaries | Unquoted expression specifying boundary divisions. Options are  | 
| type | Unquoted expression specifying type of map. Options are  | 
| province | An unquoted expression specifying province to plot. Acceptable input is French or English province names, or two-letter provincial abbreviations. Default is to plot all provinces. | 
| territories | A logical value indicating whether or not to include territories in the the returned data frame,
default is  | 
Examples
mapcan(boundaries = census, type = standard)
Annual provincial populations data frame dating back to 1971
Description
A data set with annual information on provincial and territorial populations dating back to 1971.
Usage
province_pop_annual
Format
A data.frame with 638 rows and 3 variables:
- province
- English name of province 
- population
- Population of province 
- year
- Year 
Provinces and territories cartogram data (territories excluded)
Description
A data set with geographic information for Canadian provinces and territories, boundary divisions distorted by population size. Territories excluded.
Usage
provinces_noterr_carto
Format
A data.frame with 16797 rows and 11 variables:
- long
- Longitude 
- lat
- Latitude 
- order
- Order of layers 
- hole
- Polygon hole (TRUE or FALSE) 
- piece
- Piece 
- pr_english
- Province or territory name (English). 
- group
- Group 
- population
- 2016 Population of Province 
- pr_alpha
- Province or territory 2-letter identifier 
- pr_french
- Province or territory name (French). 
- province_sgc_code
- Province Standard Geographical Classification (SGC) code 
Source
https://www12.statcan.gc.ca/census-recensement/2011/geo/bound-limit/bound-limit-2016-eng.cfm, (under Statistics Canada Open Licence https://www.statcan.gc.ca/eng/reference/licence)
Provinces and territories standard geographic data
Description
A data set with geographic information for Canadian provinces and territories
Usage
provinces_territories
Format
A data.frame with 37111 rows and 10 variables:
- long
- Longitude 
- lat
- Latitude 
- order
- Order of layers 
- hole
- Polygon hole (TRUE or FALSE) 
- piece
- Piece 
- province_sgc_code
- Province Standard Geographical Classification (SGC) code 
- group
- Group 
- pr_english
- Province or territory name (English). 
- pr_french
- Province or territory name (French). 
- pr_alpha
- Province or territory 2-letter identifier 
Source
https://www12.statcan.gc.ca/census-recensement/2011/geo/bound-limit/bound-limit-2016-eng.cfm, (under Statistics Canada Open Licence https://www.statcan.gc.ca/eng/reference/licence)
Provinces and territories cartogram data (territories included)
Description
A data set with geographic information for Canadian provinces and territories, boundary divisions distorted by population size. Territories included.
Usage
provinces_territories_carto
Format
A data.frame with 40064 rows and 12 variables:
- long
- Longitude 
- lat
- Latitude 
- order
- Order of layers 
- hole
- Polygon hole (TRUE or FALSE) 
- piece
- Piece 
- pr_english
- Province or territory name (English). 
- group
- Group 
- population
- 2016 Population of Province 
- pr_alpha
- Province or territory 2-letter identifier 
- pr_french
- Province or territory name (French). 
- province_sgc_code
- Province Standard Geographical Classification (SGC) code 
Source
https://www12.statcan.gc.ca/census-recensement/2011/geo/bound-limit/bound-limit-2016-eng.cfm, (under Statistics Canada Open Licence https://www.statcan.gc.ca/eng/reference/licence)
Quebec provincial ridings geographic data
Description
A data set with geographic information for Quebec provincial ridings
Usage
quebec_prov_ridings2018
Format
A data.frame with 23995 rows and 11 variables:
- long
- y-axis of riding hexagons 
- lat
- x-axis of riding hexagons 
- order
- Order of layers 
- hole
- Polygon hole (TRUE or FALSE) 
- piece
- Piece 
- riding_code
- Uniquely identifies a provincial electoral district 
- group
- Group 
- riding_name
- Riding name (lowercase) 
- riding_name
- Riding name (uppercase) 
- centroid_long
- Longitude for riding centroids (useful for labeling) 
- centroid_lat
- Latitude for riding centroids (useful for labeling) 
Quebec provincial election results data
Description
A data set with information on 2018 Quebec provincial election results
Usage
quebec_provincial_results
Format
A data.frame with 125 rows and 6 variables:
- party
- Winning party of riding. 
- vote_share
- Percentage of vote won by winning candidate. 
- riding_code
- Uniquely identifies a provincial electoral district 
- riding_name
- Riding name (lowercase) 
- riding_name
- Riding name (uppercase) 
Quebec provincial riding bins (used for tile plots)
Description
A data set with coordinates for the mapcan::riding_binplot() function.
Usage
quebec_riding_bins
Format
A data.frame with 125 rows and 6 variables:
- y
- y-axis of riding bins (corresponds to longitude) 
- x
- x-axis of riding bins (corresponds to latitude) 
- riding_code
- Riding code 
- region
- Region 
- riding_simplified
- Simplified riding name 
- riding_name
- Riding name 
Quebec provincial riding hexagons (used for hexagonal tile plots)
Description
A data set with coordinates for the mapcan::riding_binplot() function.
Usage
quebec_riding_hexagons
Format
A data.frame with 6629 rows and 15 variables:
- long
- y-axis of riding hexagons 
- lat
- x-axis of riding hexagons 
- order
- Order of layers 
- hole
- Polygon hole (TRUE or FALSE) 
- piece
- Piece 
- group
- Group 
- y
- y-axis of riding hexagon center 
- x
- x-axis of riding hexagon center 
- region
- Region 
- riding_simplified
- Simplified riding name 
- riding_name
- Riding name 
- riding_code
- Riding code 
Canadian federal ridings tile plot function
Description
A function that returns a data frame with map data, for use in ggplot.
Usage
riding_binplot(riding_data, riding_col = riding_code, value_col,
  continuous = TRUE, arrange = FALSE, riding_border_col = "white",
  year = 2015, riding_border_size = 1, provincial = FALSE,
  shape = "square", province, legend_name = "default")
Arguments
| riding_data | A dataframe with a continuous or categorical riding-level characteristic and a riding code variable. | 
| riding_col | An unquoted character expression specifying the riding code variable from the dataframe
provided in  | 
| value_col | An unquoted character expression specifying the column or categorical riding level characteristic you would like to visualize. | 
| continuous | logical. Specify as  | 
| arrange | logical. Specify as  | 
| riding_border_col | To ensure the appearance of stand alone tiles, set 'riding_border_col'
to be the same as the background colour of the plot. Default is  | 
| year | Election year. Options are  | 
| riding_border_size | Change the size of tiles. Larger values make smaller tiles. Default is  | 
| provincial | logical. Specify as FALSE for provincial (not federal) ridings of a single province.
If  | 
| shape | Unquoted character expression specifying shape of tiles. Options are square and hexagon, default is square. | 
| province | An unquoted character expression specifying the 2-letter provincial abbreviation of the province for which provincial electoral boundaries are desired. (Note: this argument is still in development, only Quebec provincial boundaries are available at the moment.) | 
| legend_name | Quoted chacter expression specifying the title of the legend. The variable name will be used as a default if no value is supplied. | 
Examples
election_2015 <- federal_election_results[federal_election_results$election_year == 2015, ]
riding_binplot(riding_data = election_2015, riding_col = riding_code,
value_col = party, continuous = FALSE, arrange = TRUE)
Canadian federal riding population information
Description
A data set with information on Canadian federal election results, dating back to 1997
Usage
riding_info
Format
A data.frame with 37111 rows and 12 variables:
- party
- Winning party in riding 
- riding_code
- Riding code 
- population_2011
- Population of riding in 2011 
- population_2016
- Population of riding in 2016 
Source
http://www.elections.ca/content.aspx?section=ele&dir=pas&document=index&lang=e, (under Open Government Licence https://open.canada.ca/en/open-government-licence-canada)
Mapcan theme
Description
A ggplot theme that removes unnecessary components of map plots. Builds on theme_bw().
Usage
theme_mapcan(legend_position = "bottom", base_size = 12,
  base_family = "")
Arguments
| legend_position | Position of legend, default is "bottom" | 
| base_size | Base font size (default is 12) | 
| base_family | Base font family |