
Prepare Boundary Correspondence for Cross-Election Comparison
Source:R/prepare_boundaries.R
prepare_boundaries.RdCreates a correspondence table that maps geographic units from one election event to the boundaries of another event or geographic standard. This enables comparison of election results across different boundary configurations by providing ratios that indicate how source areas map to target areas.
Usage
prepare_boundaries(
event = c("2025 Federal Election", "2023 Referendum", "2022 Federal Election",
"2019 Federal Election", "2016 Federal Election", "2013 Federal Election"),
compare_to = c("2025 Federal Election", "2023 Referendum", "2022 Federal Election",
"2021 Postcodes", "2021 Census", "2019 Federal Election", "2016 Federal Election",
"2016 Postcodes", "2016 Census", "2013 Federal Election", "2011 Postcodes",
"2011 Census"),
process = TRUE
)Arguments
- event
Character string specifying the source election event whose results you want to re-map. The geographic base varies by event:
- "2025 Federal Election"
Uses 2021 ASGS SA1 boundaries
- "2023 Referendum", "2022 Federal Election", "2019 Federal Election"
Use 2016 ASGS SA1 boundaries
- "2016 Federal Election"
Uses 2011 ASGS SA1 boundaries
- "2013 Federal Election"
Uses 2006 Census Collector Districts
- compare_to
Character string specifying the target boundaries to map to. Options include federal elections, referendums, Census SA1s, and postcodes:
- Elections/Referendum
Map to CED boundaries for that event (e.g., "2025 Federal Election")
- Census
Map to SA1 boundaries for that Census year (e.g., "2021 Census")
- Postcodes
Map to Postal Areas for that year (e.g., "2021 Postcodes")
- process
Logical. If
TRUE(default), removes geographic units with correspondence ratios that don't sum to 1 (indicating data quality issues). IfFALSE, retains all data but issues warnings for problematic units.
Value
A data frame containing the boundary correspondence with columns for:
Source geographic unit identifiers (CD or SA1 codes)
Target geographic unit identifiers (SA1, POA, or CED)
Ratio column(s) indicating proportion of source mapping to target
The exact columns depend on the event and compare_to combination.
Details
This function is central to comparing election results across different boundary configurations. Australian electoral boundaries change due to redistributions, and the ABS updates SA1 boundaries with each Census. This function builds correspondence tables that account for these changes.
The function works by:
Determining the base geography for the source
eventBuilding a correspondence chain to the target SA1 year via
get_correspondenceIf target is POA or CED, merging with allocation tables via
get_allocation_tableFor recent elections (2022, 2023, 2025), applying redistribution adjustments via
apply_redistribution_adjustmentsto correct for boundary changes that occurred after ABS allocation files were published
Valid Combinations
Not all event/compare_to combinations are valid. Generally:
You can map forward in time (older events to newer boundaries)
You cannot map to boundaries from an earlier ASGS edition than the event uses
Examples
if (FALSE) { # \dontrun{
# Map 2019 election results to 2025 electoral boundaries
corresp <- prepare_boundaries(
event = "2019 Federal Election",
compare_to = "2025 Federal Election"
)
# Map 2022 election results to 2021 postcodes
corresp <- prepare_boundaries(
event = "2022 Federal Election",
compare_to = "2021 Postcodes"
)
# Map 2013 election results (CD-based) to 2021 SA1 boundaries
corresp <- prepare_boundaries(
event = "2013 Federal Election",
compare_to = "2021 Census"
)
} # }