Skip to contents

Filters, transforms and standardises ABS-style spatial datasets.

Usage

transform_spatial_data(
  data_xx = NULL,
  id_1L_chr = "C21_G01_SA2",
  filters_ls = list(),
  naming_fn = labelled::to_character,
  region_columns_chr = c("region_type", "region"),
  transformation_args_ls = list(),
  transformation_fns_ls = list(),
  output_1L_chr = c("tbl_df", "data.frame", "data.table"),
  region_type_1L_chr = character()
)

Arguments

data_xx

Spatial dataset. If NULL, data are retrieved using readabs::read_api().

id_1L_chr

ABS dataset identifier.

filters_ls

Named list of filtering rules.

naming_fn

Function used to derive region names.

region_columns_chr

Variable names identifying geographic type and geographic code columns.

transformation_args_ls

Arguments supplied to transformation functions.

transformation_fns_ls

Named list of transformation functions.

output_1L_chr

Output type. One of "tbl_df", "data.frame" or "data.table".

region_type_1L_chr

Geographic level to retain. Typical values include "SA2", "SA3", "SA4" and "STE".

Value

A transformed spatial dataset.

Details

The function can optionally download ABS data, apply filters, transform variables, create region identifiers and convert output into a specified table format.

This function serves as a common preprocessing step for many spatial lookup and contingency table constructors in the package.

Examples

if (FALSE) { # \dontrun{
transform_spatial_data(
  id_1L_chr = "C21_G01_SA2",
  filters_ls = list(state = "5"),
  region_type_1L_chr = "SA2",
  output_1L_chr = "tbl_df"
)
} # }