Generates an age-sex contingency table from ABS-style spatial data. Optionally transforms spatial data before aggregating counts into user-specified age and sex classifications.
Usage
make_age_sex_by_region(
data_xx = NULL,
age_coding_1L_chr = "three",
age_new_1L_chr = "AgeGroup",
age_old_1L_chr = "pchar",
extras_chr = character(),
id_1L_chr = "C21_G01_SA2",
filters_ls = list(),
naming_fn = labelled::to_character,
region_columns_chr = c("region_type", "region"),
sex_old_1L_chr = "sexp",
sex_new_1L_chr = "SEXP",
transformation_args_ls = list(),
transformation_fns_ls = list(),
transform_spatial_1L_lgl = TRUE,
output_1L_chr = c("tbl_df", "data.frame", "data.table"),
region_type_1L_chr = "SA3"
)Arguments
- data_xx
A spatial dataset.
- age_coding_1L_chr
Age classification scheme passed to
add_recoded_age(). Defaults to"three".- age_new_1L_chr
Name of the age-group variable to create. Defaults to
"AgeGroup".- age_old_1L_chr
Name of the source age variable. Defaults to
"pchar".- extras_chr
Additional grouping variables to retain.
- id_1L_chr
ABS dataset identifier used when spatial data must be retrieved. Defaults to
"C21_G01_SA2".- filters_ls
Named list of filtering values applied prior to summarisation.
- naming_fn
Function used to generate region names. Defaults to
labelled::to_character.- region_columns_chr
Names of columns containing region type and region code information.
- sex_old_1L_chr
Name of the source sex variable.
- sex_new_1L_chr
Name of the output sex variable.
- transformation_args_ls
Arguments passed to transformation functions.
- transformation_fns_ls
Named list of transformation functions.
- transform_spatial_1L_lgl
Logical indicating whether spatial preprocessing should be performed.
- output_1L_chr
Output type. One of
"tbl_df","data.frame"or"data.table".- region_type_1L_chr
Geographic level to retain (for example
"SA2","SA3"or"SA4").
