Title: | Exploring Election and Census Highly Informative Data Nationally for Australia |
---|---|
Description: | Data from the seven Australian Federal Elections (House of Representatives) between 2001 and 2019, and from the four Australian Censuses over the same period. Includes tools for visualizing and analysing the data, as well as imputing Census data for years in which a Census does not occur. This package incorporates data that is copyright Commonwealth of Australia (Australian Electoral Commission and Australian Bureau of Statistics) 2019. |
Authors: | Jeremy Forbes [aut, cre], Di Cook [aut], Anthony Ebert [aut], Heike Hofmann [aut], Rob Hyndman [aut], Thomas Lumley [aut], Ben Marwick [aut], Carson Sievert [aut], Mingzhu Sun [aut], Dilini Talagala [aut], Nicholas Tierney [aut], Nathaniel Tomasetti [aut], Earo Wang [aut], Fang Zhou [aut], Commonwealth of Australia AEC [cph], Australian Bureau of Statistics ABS [cph] |
Maintainer: | Jeremy Forbes <[email protected]> |
License: | GPL (>= 2) |
Version: | 1.4.2 |
Built: | 2024-11-17 03:56:28 UTC |
Source: | https://github.com/jforbes14/eechidna |
A dataset containing demographic and other information about each electorate from the Australian Census of Population and Housing.
The data were obtained from the Australian Bureau of Statistics, and downloaded from https://www.censusdata.abs.gov.au/datapacks/. Electorate boundaries match those in place at the time of the relevant data.
Census data for non-census years has been imputed. For more details on this process,
see the help vignette: vignette("imputing-census-data", package = "eechidna")
Data for 2004, 2007, 2010 and 2013 was updated in October 2019. The older versions can be found in the GitHub repository.
abs2001 abs2004 abs2006 abs2007 abs2010 abs2011 abs2013 abs2016 abs2019 abs2021
abs2001 abs2004 abs2006 abs2007 abs2010 abs2011 abs2013 abs2016 abs2019 abs2021
Data frames with the following variables, variables with an asterisk are only available in the 2001, 2006, 2011, 2016 and 2022 data sets.
UniqueID: Numeric identifier that links the electoral division with Census and other election datasets.
DivisionNm: Name of electorate
State: State containing electorate
Population: Total population of electorate
Area*: Area of electorate division in square kilometres
Age00_04: Percentage of people aged 0-4.
Age05_14: Percentage of people aged 5-9.
Age15_19: Percentage of people aged 15-19.
Age20_24: Percentage of people aged 20-24.
Age25_34: Percentage of people aged 25-34.
Age35_44: Percentage of people aged 35-44.
Age45_54: Percentage of people aged 45-54.
Age55_64: Percentage of people aged 55-64.
Age65_74: Percentage of people aged 65-74.
Age75_84: Percentage of people aged 75-84.
Age85plus: Percentage of people aged 85 or higher.
Anglican: Percentage of people affiliated with the Anglican denomimation
AusCitizen: Percentage of people who are Australian Citizens
AverageHouseholdSize: Average number of people in a household
BachelorAbv: Percentage of people who have completed a Bachelor degree or above
Born_Asia: Percentage of people born in Asia
Born_MidEast: Percentage of people born in the Middle East
Born_SE_Europe: Percentage of people born in South Eastern Europe
Born_UK: Percentage of people born in the United Kingdom
BornElsewhere: Percentage of people who were born overseas, outside of Asia, Middle East, South Eastern Europe and the UK
BornOverseas_NS*: Percentage of people who did not answer the question relating to birthplace
Buddhism: Percentage of people affiliated with the Buddhist religion
Catholic: Percentage of people affiliated with the Catholic denomimation
Christianity: Percentage of people affiliated with the Christian religion (of all denominations)
Couple_NoChild_House: Percentage of households made up of a couple with no children
Couple_WChild_House: Percentage of households made up of a couple with children
CurrentlyStudying: Percentage of people who are currently studying
DeFacto: Percentage of people who are in a de facto marriage
DiffAddress: Percentage of people who live at a different address to what they did 5 years ago
DipCert: Percentage of people who have completed a diploma or certificate
Distributive: Percentage of employed persons who work in wholesale trade, retail trade, transport, post or warehousing related industries
EmuneratedElsewhere: Percentage of people who receive emuneration outside of Australia, out of the total population plus overseas visitors
EnglishOnly: Percentage of people who speak only English
Extractive: Percentage of employed persons who work in extractive industries (includes mining, gas, water, agriculture, waste, electricity)
FamilyIncome_NS*: Percentage of people who did not answer the question relating to family income
FamilyRatio: Average number of people per family
Finance: Percentage of employed persons who work in finance or insurance related industries
HighSchool: Percentage of people who have completed high school
HighSchool_NS*: Rate of nonresponse for questions relating to high school completion
HouseholdIncome_NS*: Percentage of people who did not answer the question relating to household income
Indigenous: Percentage of people who are Indigenous
InternetAccess: Percentage of people with access to the internet
InternetAccess_NS*: Rate of nonresponse for questions relating to internal access
InternetUse: Percentage of people who used internet in the last week (2001 only)
InternetUse_NS*: Rate of nonresponse for questions relating to internet use (2001 only)
Islam: Percentage of people affiliated with the Islamic religion
Judaism: Percentage of people affiliated with the Jewish religion
Laborer: Percentage of employed persons who work as a laborer
Language_NS*: Rate of nonresponse for questions relating to language spoken at home
LFParticipation: Labor force participation rate
ManagerAdminClericalSales: Percentage of employed persons who work in management, administration, clerical duties and sales
Married: Percentage of people who are married
MedianAge: Median age
MedianFamilyIncome: Median weekly family income (in $)
MedianHouseholdIncome: Median weekly household income (in $)
MedianLoanPay: Median mortgage loan repayment amount (of mortgage payments, in $)
MedianPersonalIncome: Median weekly personal income (in $)
MedianRent: Median weekly rental payment amount (of those who rent, in $)
Mortgage: Percentage of dwellings that are on a mortgage
NoReligion: Percentage of people with no religion
OneParent_House: Percentage of households made up of one parent with children
Other_NonChrist: Percentage of people affiliated with a religion other than Christianity, Buddhism, Islam and Judaism
OtherChrist: Percentage of people affiliated with a denomination of the Christian religion other than Anglican or Catholic
OtherLanguageHome: Percentage of people who speak a language other than English at home
Owned: Percentage of dwellings that are owned outright
PersonalIncome_NS*: Rate of nonresponse for questions relating to personal income
Professional: Percentage of employed persons who work as a professional
PublicHousing: Percentage of dwellings that are owned by the government, and rented out to tenants
Religion_NS*: Rate of nonresponse for questions relating to religion
Rent_NS*: Rate of nonresponse for questions relating to rental costs
Renting: Percentage of dwellings that are being rented
SocialServ: Percentage of employed persons who work in education and training, healthcare, social work, community, arts and recreation
SP_House: Percentage of households occupied by a single person
Tenure_NS*: Rate of nonresponse for questions relating to tenure
Tradesperson: Percentage of employed persons who specialise in a trade
Transformative: Percentage of employed persons who work in construction or manufacturing related industries
Unemployed: Unemployment rate
University_NS*: Rate of nonresponse for questions relating to University
Volunteer: Percentage of people who work as a volunteer
Volunteer_NS*: Rate of nonresponse for questions relating to working as a volunteer
An object of class data.frame
with 150 rows and 71 columns.
library(eechidna) library(dplyr) data(abs2001) abs2001 %>% select(DivisionNm, MedianAge, Unemployed, NoReligion, MedianPersonalIncome) %>% head() # Join with two-party preferred voting data library(ggplot2) data(tpp01) election2001 <- left_join(abs2001, tpp01, by = "UniqueID") # See relationship between personal income and Liberal/National support ggplot(election2001, aes(x = MedianPersonalIncome, y = LNP_Percent)) + geom_jitter() + geom_smooth(method='lm')
library(eechidna) library(dplyr) data(abs2001) abs2001 %>% select(DivisionNm, MedianAge, Unemployed, NoReligion, MedianPersonalIncome) %>% head() # Join with two-party preferred voting data library(ggplot2) data(tpp01) election2001 <- left_join(abs2001, tpp01, by = "UniqueID") # See relationship between personal income and Liberal/National support ggplot(election2001, aes(x = MedianPersonalIncome, y = LNP_Percent)) + geom_jitter() + geom_smooth(method='lm')
Add the cartogram locations as new variables to original data and make any of these that were not made equal to the original centroids. This is simply all of the Australian electoral cartogram steps in one hit.
aec_add_carto_f(nat_data)
aec_add_carto_f(nat_data)
nat_data |
subset of data with centroids of electoral divisions |
library(eechidna) library(dplyr) library(ggplot2) nat_map16 <- nat_map_download(2016) nat_data16 <- nat_data_download(2016) nat_data16 <- nat_data16 %>% select(-c(x,y)) # remove existing cartogram coordinates nat_data_cart <- aec_add_carto_f(nat_data16) # Map theme library(ggthemes) ggplot(data=nat_data_cart, aes(map_id=id)) + geom_map(map = nat_map16, fill="grey90", colour="white") + geom_point(aes(x=x, y=y), size=2, alpha=0.4, colour="#572d2c", inherit.aes=FALSE) + expand_limits(x=nat_map16$long, y=nat_map16$lat) + theme_map() + coord_equal()
library(eechidna) library(dplyr) library(ggplot2) nat_map16 <- nat_map_download(2016) nat_data16 <- nat_data_download(2016) nat_data16 <- nat_data16 %>% select(-c(x,y)) # remove existing cartogram coordinates nat_data_cart <- aec_add_carto_f(nat_data16) # Map theme library(ggthemes) ggplot(data=nat_data_cart, aes(map_id=id)) + geom_map(map = nat_map16, fill="grey90", colour="white") + geom_point(aes(x=x, y=y), size=2, alpha=0.4, colour="#572d2c", inherit.aes=FALSE) + expand_limits(x=nat_map16$long, y=nat_map16$lat) + theme_map() + coord_equal()
The dorling algorithm creates a non-contiguous cartogram by shifting circles to alleviate overlap, while roughly maintaining geographic proximity.
aec_carto_f( aec_data_sub, polygon.vertex = 6, name.text = TRUE, dist.ratio = dist.ratio, iteration = 100, xlab = "", ylab = "", ... )
aec_carto_f( aec_data_sub, polygon.vertex = 6, name.text = TRUE, dist.ratio = dist.ratio, iteration = 100, xlab = "", ylab = "", ... )
aec_data_sub |
subset of data with centroids of electoral divisions |
polygon.vertex |
The number of vertice of the circle. Default to be 100. If polygon.vertex=4 then diamonds applies. If polygon.vertex=6, then hexagon applies. |
name.text |
whether to print the region names on the circles or polygons. |
dist.ratio |
The threshold to determine whether an attract force is added. It is applied to the ratio of the distance between two centroids and the sum of the two radii. |
iteration |
The limit of the number of iterations. Default to be 9999. |
xlab |
Label for dorling x axis, intermediate drawing |
ylab |
Label for dorling y axis, intermediate drawing |
... |
arguments to dorling function |
library(dplyr) library(ggplot2) nat_map16 <- nat_map_download(2016) nat_data16 <- nat_data_download(2016) nat_data16 <- nat_data16 %>% select(-c(x,y)) # remove existing cartogram coordinates adelaide <- aec_extract_f(nat_data16, ctr=c(138.6, -34.9), expand=c(2,3)) adelaide_carto <- aec_carto_f(adelaide) %>% rename(id=region) ggplot(data=nat_map16) + geom_path(aes(x=long, y=lat, group=group, order=order), colour="grey50") + geom_point(data=adelaide_carto, aes(x=x, y=y), size=4, alpha=0.4, colour="#f0027f") + xlim(c(136, 140)) + ylim(-36, -33) + coord_equal() adelaide_all <- merge(adelaide, adelaide_carto, by="id") ggplot(data=nat_map16) + geom_path(aes(x=long, y=lat, group=group, order=order), colour="grey50") + geom_point(data=adelaide_all, aes(x=long_c, y=lat_c), size=2, alpha=0.4, colour="#f0027f") + geom_point(data=adelaide_all, aes(x=x, y=y), size=2, alpha=0.4, colour="#f0027f") + geom_segment(data=adelaide_all, aes(x=long_c, xend=x, y=lat_c, yend=y), colour="#f0027f") + xlim(c(136, 140)) + ylim(-37, -33) + coord_equal()
library(dplyr) library(ggplot2) nat_map16 <- nat_map_download(2016) nat_data16 <- nat_data_download(2016) nat_data16 <- nat_data16 %>% select(-c(x,y)) # remove existing cartogram coordinates adelaide <- aec_extract_f(nat_data16, ctr=c(138.6, -34.9), expand=c(2,3)) adelaide_carto <- aec_carto_f(adelaide) %>% rename(id=region) ggplot(data=nat_map16) + geom_path(aes(x=long, y=lat, group=group, order=order), colour="grey50") + geom_point(data=adelaide_carto, aes(x=x, y=y), size=4, alpha=0.4, colour="#f0027f") + xlim(c(136, 140)) + ylim(-36, -33) + coord_equal() adelaide_all <- merge(adelaide, adelaide_carto, by="id") ggplot(data=nat_map16) + geom_path(aes(x=long, y=lat, group=group, order=order), colour="grey50") + geom_point(data=adelaide_all, aes(x=long_c, y=lat_c), size=2, alpha=0.4, colour="#f0027f") + geom_point(data=adelaide_all, aes(x=x, y=y), size=2, alpha=0.4, colour="#f0027f") + geom_segment(data=adelaide_all, aes(x=long_c, xend=x, y=lat_c, yend=y), colour="#f0027f") + xlim(c(136, 140)) + ylim(-37, -33) + coord_equal()
Add the cartogram locations as new variables to original data and make any of these that were not made equal to the original centroids
aec_carto_join_f(aec_data, aec_carto)
aec_carto_join_f(aec_data, aec_carto)
aec_data |
subset of data with centroids of electoral divisions |
aec_carto |
centers |
library(dplyr) library(ggplot2) nat_map16 <- nat_map_download(2016) nat_data16 <- nat_data_download(2016) nat_data16 <- nat_data16 %>% select(-c(x,y)) # remove existing cartogram coordinates cities <- list(c(151.2, -33.8), # Sydney c(153.0, -27.5), # Brisbane c(145.0, -37.8), # Melbourne c(138.6, -34.9), # Adelaide, c(115.9, -32.0)) # Perth expand <- list(c(2,3.8), c(2,3), c(2.6,4.1), c(4,3), c(12,6)) nat_carto <- purrr::map2(.x=cities, .y=expand, .f=aec_extract_f, aec_data=nat_data16) %>% purrr::map_df(aec_carto_f) %>% mutate(region=as.integer(as.character(region))) %>% rename(id=region) nat_data_cart <- aec_carto_join_f(nat_data16, nat_carto) library(ggthemes) ggplot(data=nat_data16, aes(map_id=id)) + geom_map(map = nat_map16, fill="grey90", colour="white") + geom_point(data=nat_data_cart, aes(x=x, y=y), size=2, alpha=0.4, colour="#572d2c", inherit.aes=FALSE) + expand_limits(x=nat_map16$long, y=nat_map16$lat) + theme_map() + coord_equal()
library(dplyr) library(ggplot2) nat_map16 <- nat_map_download(2016) nat_data16 <- nat_data_download(2016) nat_data16 <- nat_data16 %>% select(-c(x,y)) # remove existing cartogram coordinates cities <- list(c(151.2, -33.8), # Sydney c(153.0, -27.5), # Brisbane c(145.0, -37.8), # Melbourne c(138.6, -34.9), # Adelaide, c(115.9, -32.0)) # Perth expand <- list(c(2,3.8), c(2,3), c(2.6,4.1), c(4,3), c(12,6)) nat_carto <- purrr::map2(.x=cities, .y=expand, .f=aec_extract_f, aec_data=nat_data16) %>% purrr::map_df(aec_carto_f) %>% mutate(region=as.integer(as.character(region))) %>% rename(id=region) nat_data_cart <- aec_carto_join_f(nat_data16, nat_carto) library(ggthemes) ggplot(data=nat_data16, aes(map_id=id)) + geom_map(map = nat_map16, fill="grey90", colour="white") + geom_point(data=nat_data_cart, aes(x=x, y=y), size=2, alpha=0.4, colour="#572d2c", inherit.aes=FALSE) + expand_limits(x=nat_map16$long, y=nat_map16$lat) + theme_map() + coord_equal()
The dorling algorithm doesn't work on the entire country, because it is very clustered at the cities. To get a reasonable cartogram we need to extract out the cities, expand these with dorling independently. This function does the extraction.
aec_extract_f(aec_data, ctr = c(151.2, -33.8), expand = c(3, 4.5), ...)
aec_extract_f(aec_data, ctr = c(151.2, -33.8), expand = c(3, 4.5), ...)
aec_data |
data with centroids of electoral divisions |
ctr |
centroids of subset |
expand |
how large a chunk to cut out |
... |
other arguments |
library(dplyr) library(ggplot2) nat_map16 <- nat_map_download(2016) nat_data16 <- nat_data_download(2016) nat_data16 <- nat_data16 %>% select(-c(x,y)) # remove existing cartogram coordinates adelaide <- aec_extract_f(nat_data16, ctr=c(138.6, -34.9), expand=c(2,3)) ggplot(data=nat_map16) + geom_polygon(aes(x=long, y=lat, group=group, order=order), fill="grey90", colour="white") + geom_point(data=adelaide, aes(x=long_c, y=lat_c), size=2, alpha=0.4, colour="#f0027f") + xlim(c(136, 142)) + ylim(-36, -33) + coord_equal()
library(dplyr) library(ggplot2) nat_map16 <- nat_map_download(2016) nat_data16 <- nat_data_download(2016) nat_data16 <- nat_data16 %>% select(-c(x,y)) # remove existing cartogram coordinates adelaide <- aec_extract_f(nat_data16, ctr=c(138.6, -34.9), expand=c(2,3)) ggplot(data=nat_map16) + geom_polygon(aes(x=long, y=lat, group=group, order=order), fill="grey90", colour="white") + geom_point(data=adelaide, aes(x=long_c, y=lat_c), size=2, alpha=0.4, colour="#f0027f") + xlim(c(136, 142)) + ylim(-36, -33) + coord_equal()
Using the electoral boundaries at the time of an election and the centroids from the SA1 polygons from a neighbouring Census, allocate each SA1 to the electoral division that contains its centroid.
allocate_electorate( centroids_ls, electorates_sf, census_year = NA, election_year = NA )
allocate_electorate( centroids_ls, electorates_sf, census_year = NA, election_year = NA )
centroids_ls |
list containing centroids as SpatialPoints and a dataframe with basic data on each polygon (e.g. name) |
electorates_sf |
shapefile with electoral boundaries |
census_year |
census year |
election_year |
election year |
data frame detailing which electoral division each Census polygon is allocated to
## Not run: # Mapping each SA1 from the 2011 Census to the 2013 electoral boundaries mapping_c11_e13 <- allocate_electorate(centroids_ls = centroids_sa1_2011, electorates_sf = sF_13, census_year = "2011", election_year = "2013") ## End(Not run)
## Not run: # Mapping each SA1 from the 2011 Census to the 2013 electoral boundaries mapping_c11_e13 <- allocate_electorate(centroids_ls = centroids_sa1_2011, electorates_sf = sF_13, census_year = "2011", election_year = "2013") ## End(Not run)
##' From https://github.com/chxy/cartogram/blob/master/R/dorling.R Not exported here, but needed for aec_carto_f
circle( xvec, yvec, rvec, vertex = 100, border = 1, col = NULL, add = TRUE, square = FALSE, ... )
circle( xvec, yvec, rvec, vertex = 100, border = 1, col = NULL, add = TRUE, square = FALSE, ... )
xvec |
X-coordinates |
yvec |
Y-coordinates |
rvec |
Radii |
vertex |
The number of vertices of the circle |
border |
Color of border |
col |
Color to render in circle |
add |
Whether the circles are added to another plot. |
square |
A logical value to determine whether to draw squares. |
... |
other things |
This function is used to compute the locations of the circle border and draw multiple circles. It borrows the code from plotrix::draw.circle
## Not run: x=y=1:5 r=5:1/5 circle(x,y,r,add=FALSE,asp=1) circle(x,y,r,vertex=6,add=TRUE) # hexagon circle(x,y,r,vertex=4,add=TRUE) # diamond circle(x,y,r,square=TRUE,add=TRUE) # square ## End(Not run)
## Not run: x=y=1:5 r=5:1/5 circle(x,y,r,add=FALSE,asp=1) circle(x,y,r,vertex=6,add=TRUE) # hexagon circle(x,y,r,vertex=4,add=TRUE) # diamond circle(x,y,r,square=TRUE,add=TRUE) # square ## End(Not run)
From https://github.com/chxy/cartogram/blob/master/R/dorling.R Not exported here, but needed for aec_carto_f
complete_color(cl, targetlen)
complete_color(cl, targetlen)
cl |
a vector of colors |
targetlen |
the target length |
a vector of completed cl with length n
## Not run: complete_color('red',5) complete_color(c('red','blue'),5) complete_color(c('red','blue','green','yellow','pink','grey'),5) ## End(Not run)
## Not run: complete_color('red',5) complete_color(c('red','blue'),5) complete_color(c('red','blue','green','yellow','pink','grey'),5) ## End(Not run)
From https://github.com/chxy/cartogram/blob/master/R/dorling.R Not exported here, but needed for aec_carto_f
dorling( name, centroidx, centroidy, density, nbr = NULL, shared.border = NULL, color = NULL, tolerance = 0.1, dist.ratio = 1.2, iteration = 9999, polygon.vertex = 100, animation = FALSE, sleep.time = 0.3, nbredge = ifelse(is.null(nbr), FALSE, TRUE), name.text = TRUE, ggplot2 = FALSE, ... )
dorling( name, centroidx, centroidy, density, nbr = NULL, shared.border = NULL, color = NULL, tolerance = 0.1, dist.ratio = 1.2, iteration = 9999, polygon.vertex = 100, animation = FALSE, sleep.time = 0.3, nbredge = ifelse(is.null(nbr), FALSE, TRUE), name.text = TRUE, ggplot2 = FALSE, ... )
name |
A vector of region names. |
centroidx |
A vector of x-coordinates of the regions. |
centroidy |
A vector of y-coordinates of the regions. |
density |
A vector of the variable of interest. It will be used as the radii of the circles. |
nbr |
A list of the neighbors of every region. Each element is a vector of all the neighbor names of a region. If nbr=NULL, then it is assumed that no region has any neighbors. If nbr is not NULL, then names should be given to all the elements of the list, for matching the neighbors with the host region name, otherwise the parameter "name" (a character vector) will be used as the element names of nbr. Besides, any values in nbr that are not in "name" will be removed. The length of nbr could be different from the length of "name", but any element in nbr whose name is not in "name" will be removed too. |
shared.border |
A matrix of the counts of shared borders, typically generated from the function |
color |
a vector of color to fill in the circles or polygons. Auto-completed if the length does not match with name. |
tolerance |
Tolerant value for the sum of overlapped radii. |
dist.ratio |
The threshold to determine whether an attract force is added. It is applied to the ratio of the distance between two centroids and the sum of the two radii. |
iteration |
The limit of the number of iterations. Default to be 9999. |
polygon.vertex |
The number of vertice of the circle. Default to be 100. If polygon.vertex=4 then diamonds applies. If polygon.vertex=6, then hexagon applies. |
animation |
Whether to show the movements of centroids. |
sleep.time |
Only works when animation=TRUE. |
nbredge |
whether to draw the lines between neighbor regions. |
name.text |
whether to print the region names on the circles or polygons. |
ggplot2 |
whether to use ggplot2 to draw the cartogram. |
... |
other things |
Extract centroids from the polygons within a shapefile.
extract_centroids(shapefile)
extract_centroids(shapefile)
shapefile |
sf object containing polygon geometry |
list containing centroids as sf points object and a dataframe with basic data on each polygon (e.g. name)
## Not run: sF_download(year = 2016) electorate_centroids_2016 <- extract_centroids(sF_16) ## End(Not run)
## Not run: sF_download(year = 2016) electorate_centroids_2016 <- extract_centroids(sF_16) ## End(Not run)
Download first preference voting data from each polling booth, from the six Australian Federal elections between 2001 and 2016.
firstpref_pollingbooth_download(...)
firstpref_pollingbooth_download(...)
... |
Additional arguments passed to 'download.file' Downloads and returns first preference votes for candidates in the House of Representatives, for each polling both, in the seven Australian Federal elections between 2001 and 2016. |
A data frame with the following variables:
StateAb: Abbreviation for state name
DivisionID: Electoral division ID
DivisionNm: Electoral division name
PollingPlaceID: Polling place ID
PollingPlace: Polling place name
CandidateID: Candidate ID
Surname: Candidate surname
GivenNm: Candidate given name
BallotPosition: Candidate's position on the ballot
Elected: Whether the candidate was elected (Y/N)
HistoricElected: Whether the candidate is the incumbent member
PartyAb: Abbreviation for political party name
PartyNm: Political party name
OrdinaryVotes: Number of ordinary votes cast at the polling place for the candidate
Swing: Percentage point change in ordinary votes for the party from the previous election
PremisesPostCode: Post code of polling booth
Latitude: Coordinates
Longitude: Coordinates
year: Election year
A data frame containing first preference votes
A dataset containing first preference vote counts, candidate names, polling place locations, and other results for the House of Representatives from the 2001, 2004, 2007, 2010, 2013 and 2016 Australian federal elections. This data set is obtained using the 'firstpref_pollingbooth_download' function. The data were obtained from the Australian Electoral Commission.
## Not run: fp_pp <- firstpref_pollingbooth_download() library(dplyr) fp_pp %>% filter(year == 2016) %>% arrange(-OrdinaryVotes) %>% head ## End(Not run)
## Not run: fp_pp <- firstpref_pollingbooth_download() library(dplyr) fp_pp %>% filter(year == 2016) %>% arrange(-OrdinaryVotes) %>% head ## End(Not run)
A dataset containing first preference vote counts, candidate names, and other results for the House of Representatives from Australian federal elections from 2001 to 2022.
fp01 fp04 fp07 fp10 fp13 fp16 fp19 fp22
fp01 fp04 fp07 fp10 fp13 fp16 fp19 fp22
A data frame with the following variables:
For the 2001 election only:
UniqueID: Numeric identifier that links the electoral division with Census and other election datasets.
StateAb: Abbreviation for state name
DivisionNm: Electoral division name
Surname: Candidate surname
GivenNm: Candidate given name
PartyAb: Abbreviation for political party name
PartyNm: Political party name
Elected: Whether the candidate was elected (Y/N)
Percent: Percentage of ordinary votes for the candidate
For the 2004 election onwards:
StateAb: Abbreviation for state name
UniqueID: Numeric identifier that links the electoral division with Census and other election datasets.
DivisionNm: Electoral division name
BallotPosition: Candidate's position on the ballot
CandidateID: Candidate ID
Surname: Candidate surname
GivenNm: Candidate given name
PartyAb: Abbreviation for political party name
PartyNm: Political party name
Elected: Whether the candidate was elected (Y/N)
OrdinaryVotes: Number of ordinary votes cast at the electorate for the candidate
Percent: Percentage of ordinary votes for the candidate
https://www.aec.gov.au/About_AEC/Publications/statistics/files/aec-2001-election-statistics.zip
https://results.aec.gov.au/12246/results/HouseDownloadsMenu-12246-csv.htm
https://www.aec.gov.au/elections/federal_elections/2004/downloads.htm
https://results.aec.gov.au/13745/Website/HouseDownloadsMenu-13745-csv.htm
https://www.aec.gov.au/elections/federal_elections/2007/downloads.htm
https://results.aec.gov.au/15508/Website/HouseDownloadsMenu-15508-csv.htm
https://www.aec.gov.au/elections/federal_elections/2010/downloads.htm
https://results.aec.gov.au/17496/Website/HouseDownloadsMenu-17496-csv.htm
https://www.aec.gov.au/elections/federal_elections/2013/downloads.htm
https://results.aec.gov.au/20499/Website/HouseDownloadsMenu-20499-csv.htm
https://www.aec.gov.au/elections/federal_elections/2016/downloads.htm
https://results.aec.gov.au/24310/Website/HouseDownloadsMenu-24310-Csv.htm
https://results.aec.gov.au/27966/Website/HouseDownloadsMenu-27966-Csv.htm
This function is only used to create new map data in future elections 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 https://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 may take several minutes to complete.
get_electorate_shapes( path_to_shapeFile = NULL, sF = NULL, mapinfo = TRUE, layer = NULL, tolerance = 0.001 )
get_electorate_shapes( path_to_shapeFile = NULL, sF = NULL, mapinfo = TRUE, layer = NULL, tolerance = 0.001 )
path_to_shapeFile |
path to object in local machine (only if shapefile has not already loaded) |
sF |
Shapefile object loaded to environment using load_shapefile |
mapinfo |
Is the data mapInfo format, rather than ESRI? default=TRUE |
layer |
If the format is mapInfo, the layer name also needs to be provided, default is NULL |
tolerance |
Numerical tolerance value to be used by the Douglas-Peuker algorithm (only if shapefile has not already loaded) |
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.
## Not run: # Get electorate shapes in data.frame format # Path to your shapefile fl <- "local/path/to/shapefile.shp" map_and_data16 <- get_electorate_shapes(path_to_shapefile = fl) ## End(Not run)
## Not run: # Get electorate shapes in data.frame format # Path to your shapefile fl <- "local/path/to/shapefile.shp" map_and_data16 <- get_electorate_shapes(path_to_shapefile = fl) ## End(Not run)
Shiny app for exploring census and electorate data
launch_app( election_year = 2016, age = c("Age00_04", "Age05_14", "Age15_19", "Age20_24", "Age25_34", "Age35_44", "Age45_54", "Age55_64", "Age65_74", "Age75_84", "Age85plus"), religion = c("Christianity", "Catholic", "Buddhism", "Islam", "Judaism", "NoReligion"), other = c("AusCitizen", "MedianPersonalIncome", "Unemployed", "BachelorAbv", "Indigenous", "EnglishOnly", "OtherLanguageHome", "Married", "DeFacto", "FamilyRatio", "Owned"), palette = c("#1B9E77", "#F0027F", "#E6AB02", "#66A61E", "#7570B3", "#D95F02", "#3690C0") )
launch_app( election_year = 2016, age = c("Age00_04", "Age05_14", "Age15_19", "Age20_24", "Age25_34", "Age35_44", "Age45_54", "Age55_64", "Age65_74", "Age75_84", "Age85plus"), religion = c("Christianity", "Catholic", "Buddhism", "Islam", "Judaism", "NoReligion"), other = c("AusCitizen", "MedianPersonalIncome", "Unemployed", "BachelorAbv", "Indigenous", "EnglishOnly", "OtherLanguageHome", "Married", "DeFacto", "FamilyRatio", "Owned"), palette = c("#1B9E77", "#F0027F", "#E6AB02", "#66A61E", "#7570B3", "#D95F02", "#3690C0") )
election_year |
Year of Federal election to be explored (2001, 2004, 2007, 2010, 2013, 2016, 2019, 2022) |
age |
Age variables to show. Variable(s) should match column names from abs2016. By default, all variables are shown. |
religion |
Religion variables to show. Variable(s) should match column names from abs2016. By default, all variables are shown. |
other |
Other census variables to show. Variable(s) should match column names from abs2016. By default, all variables are shown. |
palette |
a named character vector of selection colors. The vector names are used as the display in the drop-down control. |
Carson Sievert
## Not run: library(shiny) library(plotly) library(tidyverse) # for comparing labor/liberal launch_app( election_year = 2022, age = c("Age20_24", "Age25_34", "Age55_64"), religion = c("Christianity", "Catholic", "NoReligion"), other = c("AusCitizen", "MedianPersonalIncome", "Unemployed") ) # for inspecting highly contested areas launch_app( election_year = 2022, age = c("Age25_34", "Age35_44", "Age55_64"), religion = c("Christianity", "Catholic", "NoReligion"), other = c("Owned", "Indigenous", "AusCitizen") ) launch_app() ## End(Not run)
## Not run: library(shiny) library(plotly) library(tidyverse) # for comparing labor/liberal launch_app( election_year = 2022, age = c("Age20_24", "Age25_34", "Age55_64"), religion = c("Christianity", "Catholic", "NoReligion"), other = c("AusCitizen", "MedianPersonalIncome", "Unemployed") ) # for inspecting highly contested areas launch_app( election_year = 2022, age = c("Age25_34", "Age35_44", "Age55_64"), religion = c("Christianity", "Catholic", "NoReligion"), other = c("Owned", "Indigenous", "AusCitizen") ) launch_app() ## End(Not run)
This is only used to create the new electorate map data, for future years. Load shapefile into R as an sf (simple features) object, extract polygon information, thin polygon, fix any problematic polygons, and format variable names. "nat_map" and "nat_data" objects for every Australian federal election between 2001-2019 can be readily loaded from the package for analysis.
load_shapefile(path_to_shapeFile, tolerance = 0.001)
load_shapefile(path_to_shapeFile, tolerance = 0.001)
path_to_shapeFile |
path to object in local machine |
tolerance |
numerical tolerance value to be used by the Douglas-Peuker algorithm |
The function will take several minutes to complete.
object of class SpatialPolygonsDataFrame
## Not run: # Load electorate shapefile into R # Path to your shapefile fl <- "local/path/to/shapefile.shp" # Load my_sF <- load_shapefile(fl) ## End(Not run)
## Not run: # Load electorate shapefile into R # Path to your shapefile fl <- "local/path/to/shapefile.shp" # Load my_sF <- load_shapefile(fl) ## End(Not run)
At the time of an election, compute how much each electoral division intersects with the divisions in place at the time of the Census. This is to be used in interpolating Census information for electoral divisions in a year that a Census did not occur.
mapping_fn(aec_sF, abs_sF, area_thres = 0.995)
mapping_fn(aec_sF, abs_sF, area_thres = 0.995)
aec_sF |
shapefile with boundaries at election time |
abs_sF |
shapefile with boundaries at census time |
area_thres |
threshold for which mapping is sufficient (default is 99.5%) |
data frame detailing how much Census divisions intersect with each electoral division at the time of the election.
## Not run: # Each 2013 electorate boundary's composition in terms of the # boundaries in place for the 2016 Census aec_sF_2013 <- loadShapeFile(path_to_aec_shapefile) abs_sF_2016 <- loadShapeFile(path_to_abs_shapefile) mapping_df <- mapping_fn(aec_sF = aec_sF_2013, abs_sF = abs_sF_2016, area_thres = 0.995) ## End(Not run)
## Not run: # Each 2013 electorate boundary's composition in terms of the # boundaries in place for the 2016 Census aec_sF_2013 <- loadShapeFile(path_to_aec_shapefile) abs_sF_2016 <- loadShapeFile(path_to_abs_shapefile) mapping_df <- mapping_fn(aec_sF = aec_sF_2013, abs_sF = abs_sF_2016, area_thres = 0.995) ## End(Not run)
Downloads and returns a data frame containing the points that make up the centroids for each of the Australian electorates in the desired federal election.
nat_data_download(year, ...)
nat_data_download(year, ...)
year |
Desired year, must be one of 2001, 2004, 2007, 2010, 2011, 2013, 2016, 2019 |
... |
Additional arguments passed to 'download.file' |
A data frame with data associated with each of the Australian federal electorates
id: Numeric identifier for the polygon
elect_div: Electorate division name
state: abbreviation of the state name
numccds: AEC variable that might be filled with meaning or a description down the road
area_sqkm: combined square kilometers of each electorate
long_c: longitude coordinate of electorate (polygon) centroid
lat_c: latitude coordinate of electorate (polygon) centroid
x: latitude coordinate for plotting a cartogram
y: longitude coordinate for plotting a cartogram
radius: variable used in the construction of cartogram points
library(eechidna) library(dplyr) library(ggmap) nat_data19 <- nat_data_download(2019) nat_data19 %>% qmplot(long_c, lat_c, data=.)
library(eechidna) library(dplyr) library(ggmap) nat_data19 <- nat_data_download(2019) nat_data19 %>% qmplot(long_c, lat_c, data=.)
Downloads and returns a DataFrame containing the points that outline the polygons for each of the Australian electorates in the desired federal election. The data were obtained from the Australian Electoral Commission and the Australian Bureau of Statistics.
nat_map_download(year, ...)
nat_map_download(year, ...)
year |
Desired year, must be one of 2001, 2004, 2007, 2010, 2011, 2013, 2016, 2019 |
... |
Additional arguments passed to 'download.file' |
A data frame consisting of points with the following variables:
id: Numeric identifier for the polygon
long: longitude coordinate of point in polygon
lat: latitude coordinate of point in polygon
order: order for polygon points
hole: whether polygon has a hole
piece: piece for polygon
group: group for polygon
elect_div: Electoral division name
state: Abbreviation for state name
library(eechidna) library(dplyr) library(ggmap) nat_map16 <- nat_map_download(2016) nat_map16 %>% filter(elect_div=='MELBOURNE') %>% qmplot(long, lat, data=., color='red', size=5, xlab=NA,ylab=NA) + theme(legend.position = 'none')
library(eechidna) library(dplyr) library(ggmap) nat_map16 <- nat_map_download(2016) nat_map16 %>% filter(elect_div=='MELBOURNE') %>% qmplot(long, lat, data=., color='red', size=5, xlab=NA,ylab=NA) + theme(legend.position = 'none')
Download SpatialPolygonsDataFrame containing polygons of Australian federal electorates
sF_download(year, ...)
sF_download(year, ...)
year |
Desired year, must be one of 2001, 2004, 2007, 2010, 2011, 2013, 2016, 2019 |
... |
Additional arguments passed to 'download.file' Downloads and returns a large SpatialPolygonsDataFrame containing the polygons and associated data for each of the Australian electorates in the desired federal election. This object is obtained using the 'sF_download' function. The data were obtained from the Australian Electoral Commission and the Australian Bureau of Statistics. |
A SpatialPolygonsDataFrame containing polygons of the Australian federal electorates
## Not run: sF_16 <- sF_download(year = 2016) # Plot a map of the electorates library(sp) plot(sF_16) ## End(Not run)
## Not run: sF_16 <- sF_download(year = 2016) # Plot a map of the electorates library(sp) plot(sF_16) ## End(Not run)
A dataset containing two candidate preferred vote counts, and other results for the House of Representatives from the 2001 to 2019 Australian federal elections. Includes the count of votes for the leading two candidates in the electorate after distribution of preferences.
tcp01 tcp04 tcp07 tcp10 tcp13 tcp16 tcp19 tcp22
tcp01 tcp04 tcp07 tcp10 tcp13 tcp16 tcp19 tcp22
A data frame with the following variables:
For the 2001 election:
Numeric identifier that links the electoral division with Census and other election datasets
Abbreviation for state name
Electoral division name
Candidate surname
Candidate given name
Whether the candidate was elected (Y/N)
Percentage of ordinary votes cast for the candidate
Abbreviation for political party name
Political party name
Percentage point change in ordinary votes for the party from the previous election
For the 2004 election:
Abbreviation for state name
Numeric identifier that links the electoral division with Census and other election datasets.
Electoral division name
Candidate's position on the ballot
Candidate ID
Candidate surname
Candidate given name
Abbreviation for political party name
Political party name
Whether the candidate was elected (Y/N)
Number of ordinary votes cast for the candidate
Percentage of ordinary votes cast for the candidate
For the 2007 election onwards:
Abbreviation for state name
Numeric identifier that links the electoral division with Census and other election datasets.
Electoral division name
Candidate's position on the ballot
Candidate ID
Candidate surname
Candidate given name
Abbreviation for political party name
Political party name
Whether the candidate was elected (Y/N)
Whether the candidate is the incumbent member
Number of ordinary votes cast for the candidate
Percentage of ordinary votes cast for the candidate
https://www.aec.gov.au/About_AEC/Publications/statistics/files/aec-2001-election-statistics.zip.
https://results.aec.gov.au/12246/results/HouseDownloadsMenu-12246-csv.htm
https://www.aec.gov.au/elections/federal_elections/2004/downloads.htm.
https://results.aec.gov.au/13745/Website/HouseDownloadsMenu-13745-csv.htm
https://www.aec.gov.au/elections/federal_elections/2007/downloads.htm.
https://results.aec.gov.au/15508/Website/HouseDownloadsMenu-15508-csv.htm
https://www.aec.gov.au/elections/federal_elections/2010/downloads.htm
https://results.aec.gov.au/17496/Website/HouseDownloadsMenu-17496-csv.htm
https://www.aec.gov.au/elections/federal_elections/2013/downloads.htm
https://results.aec.gov.au/20499/Website/HouseDownloadsMenu-20499-csv.htm
https://www.aec.gov.au/elections/federal_elections/2016/downloads.htm
https://results.aec.gov.au/24310/Website/HouseDownloadsMenu-24310-Csv.htm
https://results.aec.gov.au/27966/Website/HouseDownloadsMenu-27966-Csv.htm
A dataset containing two party preferred vote counts, winning candidate names, and other results for the House of Representatives from the 2001 to 2019 Australian federal elections. Includes the count of votes for the Australian Labor Party and the count of votes for the Liberal-National Coalition for each electorate.
tpp01 tpp04 tpp10 tpp07 tpp13 tpp16 tpp19 tpp22
tpp01 tpp04 tpp10 tpp07 tpp13 tpp16 tpp19 tpp22
A data frame with the following variables:
Numeric identifier that links the electoral division with Census and other election datasets.
Electoral division name
Abbreviation for state name
Count of two party preferred vote in favour of the Liberal National coalition
Percentage of two party preferred vote in favour of the Liberal National coalition
Count of two party preferred vote in favour of the Labor party
Percentage of two party preferred vote in favour of the Labor party
Total number of votes cast
Percentage point change in two party preferred vote from the previous election
https://www.aec.gov.au/About_AEC/Publications/statistics/files/aec-2001-election-statistics.zip
https://results.aec.gov.au/12246/results/HouseDownloadsMenu-12246-csv.htm
https://www.aec.gov.au/elections/federal_elections/2004/downloads.htm
https://results.aec.gov.au/15508/Website/HouseDownloadsMenu-15508-csv.htm
https://www.aec.gov.au/elections/federal_elections/2010/downloads.htm
https://results.aec.gov.au/13745/Website/HouseDownloadsMenu-13745-csv.htm
https://www.aec.gov.au/elections/federal_elections/2007/downloads.htm
https://results.aec.gov.au/17496/Website/HouseDownloadsMenu-17496-csv.htm
https://www.aec.gov.au/elections/federal_elections/2013/downloads.htm
https://results.aec.gov.au/20499/Website/HouseDownloadsMenu-20499-csv.htm
https://www.aec.gov.au/elections/federal_elections/2016/downloads.htm
https://results.aec.gov.au/24310/Website/HouseDownloadsMenu-24310-Csv.htm
https://results.aec.gov.au/27966/Website/HouseDownloadsMenu-27966-Csv.htm
Download two candidate preference voting data from each polling booth, from the five Australian Federal elections between 2004 and 2016.
twocand_pollingbooth_download(...)
twocand_pollingbooth_download(...)
... |
Additional arguments passed to 'download.file' Downloads and returns the two candidate preferred votes for candidates in the House of Representatives, for each polling both, in the five Australian Federal elections between 2004 and 2016. |
A data frame with the following variables:
StateAb: Abbreviation for state name
DivisionID: Electoral division ID
DivisionNm: Electoral division name
PollingPlaceID: Polling place ID
PollingPlace: Polling place name
CandidateID: Candidate ID
Surname: Candidate surname
GivenNm: Candidate given name
BallotPosition: Candidate's position on the ballot
Elected: Whether the candidate was elected (Y/N)
HistoricElected: Whether the candidate is the incumbent member
PartyAb: Abbreviation for political party name
PartyNm: Political party name
OrdinaryVotes: Number of ordinary votes cast at the polling place for the candidate
Swing: Percentage point change in ordinary votes for the party from the previous election
PremisesPostCode: Post code of polling booth
Latitude: Coordinates
Longitude: Coordinates
year: Election year
A data frame containing two candidate preference votes
A dataset containing two candidate preferred vote counts, polling place locations, and other results for the House of Representatives from each of the 2004, 2007, 2010, 2013 and 2016 Australian federal elections. Includes the count of votes for the leading two candidates in the electorate after distribution of preferences for each polling place. Note that 2001 two candidate preferred vote is not available in this package. This data set is obtained using the 'twocand_pollingbooth_download' function. The data were obtained from the Australian Electoral Commission,
## Not run: tcp_pp <- twocand_pollingbooth_download() library(dplyr) tcp_pp %>% filter(year == 2016) %>% arrange(-OrdinaryVotes) %>% head ## End(Not run)
## Not run: tcp_pp <- twocand_pollingbooth_download() library(dplyr) tcp_pp %>% filter(year == 2016) %>% arrange(-OrdinaryVotes) %>% head ## End(Not run)
Download two party preference voting data from each polling booth, from the seven Australian Federal elections between 2001 and 2016.
twoparty_pollingbooth_download(...)
twoparty_pollingbooth_download(...)
... |
Additional arguments passed to 'download.file' Downloads and returns the two party preferred votes for candidates in the House of Representatives, for each polling both, in the six Australian Federal elections between 2001 and 2016. |
A data frame with the following variables:
StateAb: Abbreviation for state name
DivisionID: Electoral division ID
DivisionNm: Electoral division name
PollingPlaceID: Polling place ID
PollingPlace: Polling place name
LNP_Votes: Count of two party preferred vote in favour of the Liberal National coalition
LNP_Percent: Percentage of two party preferred vote in favour of the Liberal National coalition
ALP_Votes: Count of two party preferred vote in favour of the Labor party
ALP_Percent: Percentage of two party preferred vote in favour of the Labor party
TotalVotes: Total number of votes cast
Swing: Percentage point change in two party preferred vote from the previous election
PremisesPostCode: Post code of polling booth
Latitude: Coordinates
Longitude: Coordinates
year: Election year
A data frame containing two party preference votes
A dataset containing two party preferred vote counts, winning candidate names, polling place locations, and other results for the House of Representatives from each of the 2001, 2004, 2007, 2010, 2013 and 2016 Australian federal elections. Includes the count of votes for the Australian Labor Party and the count of votes for the Liberal-National Coalition for each polling place. This data set is obtained using the 'twoparty_pollingbooth_download' function. The data were obtained from the Australian Electoral Commission.
## Not run: tpp_pp <- twoparty_pollingbooth_download() library(dplyr) tpp_pp %>% filter(year == 2016) %>% arrange(-LNP_Percent) %>% head ## End(Not run)
## Not run: tpp_pp <- twoparty_pollingbooth_download() library(dplyr) tpp_pp %>% filter(year == 2016) %>% arrange(-LNP_Percent) %>% head ## End(Not run)
This is a less refined method than using SA1 centroids, because it uses Census data aggregated at Census division level.
weighted_avg_census(mapping_df, abs_df)
weighted_avg_census(mapping_df, abs_df)
mapping_df |
data frame detailing how much Census divisions intersect with each electoral division at the time of the election. |
abs_df |
data frame holding Census information from Census year |
data frame with imputed Census data for electoral boundaries at the time of the Census
## Not run: data("abs2016") # Each 2013 electorate boundary's composition in terms of the # boundaries in place for the 2016 Census aec_sF_2013 <- loadShapeFile(path_to_aec_shapefile) abs_sF_2016 <- loadShapeFile(path_to_abs_shapefile) mapping_2016 <- mapping_fn(aec_sF = aec_sF_2013, abs_sF = abs_sF_2016) # Estimate 2016 Census data for the 2013 electorates imputed_data_2016 <- weighted_avg_census(mapping_df = mapping_2016, abs_df = abs2016) ## End(Not run)
## Not run: data("abs2016") # Each 2013 electorate boundary's composition in terms of the # boundaries in place for the 2016 Census aec_sF_2013 <- loadShapeFile(path_to_aec_shapefile) abs_sF_2016 <- loadShapeFile(path_to_abs_shapefile) mapping_2016 <- mapping_fn(aec_sF = aec_sF_2013, abs_sF = abs_sF_2016) # Estimate 2016 Census data for the 2013 electorates imputed_data_2016 <- weighted_avg_census(mapping_df = mapping_2016, abs_df = abs2016) ## End(Not run)
Function to compute weighted average of Census information using imputed populations as weights
weighted_avg_census_sa1(mapping_df, abs_df)
weighted_avg_census_sa1(mapping_df, abs_df)
mapping_df |
data frame detailing how much Census divisions intersect with each electoral division at the time of the election. |
abs_df |
data frame holding Census information from Census year |
data frame with imputed Census data for electoral boundaries at the time of the Census
## Not run: # Each 2013 electorate boundary's characteristics as at the time of the 2016 Census mapping_c16_e13 <- allocate_electorate(centroids_ls = centroids_sa1_2016, electorates_sf = sF_13, census_year = "2016", election_year = "2013") # Estimate 2016 Census data for the 2013 electorates imputed_data_2016 <- weighted_avg_census_sa1(mapping_df = mapping_2016, abs_df = abs2016_cd) ## End(Not run)
## Not run: # Each 2013 electorate boundary's characteristics as at the time of the 2016 Census mapping_c16_e13 <- allocate_electorate(centroids_ls = centroids_sa1_2016, electorates_sf = sF_13, census_year = "2016", election_year = "2013") # Estimate 2016 Census data for the 2013 electorates imputed_data_2016 <- weighted_avg_census_sa1(mapping_df = mapping_2016, abs_df = abs2016_cd) ## End(Not run)