Learn R Programming

eechidna (version 1.4.1)

weighted_avg_census: Function to compute weighted average of Census information using imputed populations as weights.

Description

This is a less refined method than using SA1 centroids, because it uses Census data aggregated at Census division level.

Usage

weighted_avg_census(mapping_df, abs_df)

Arguments

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

Value

data frame with imputed Census data for electoral boundaries at the time of the Census

Examples

Run this code
# 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)
# }

Run the code above in your browser using DataLab