| Title: | Quantifying Variable Change Induced by Administrative Boundary Transformations |
|---|---|
| Description: | Tools for auditing how analytic variables change when data are transformed across administrative boundary systems. The package is agnostic to data source, variable type, and administrative geography, and is designed to quantify transformation-induced change without attributing blame to any specific boundary definition or allocation scheme. |
| Authors: | Phinn Markson [aut, cre] |
| Maintainer: | Phinn Markson <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.0 |
| Built: | 2026-05-13 23:09:47 UTC |
| Source: | https://github.com/cran/geoDeltaAudit |
testthat::skip("Integration test: run manually (slow / uses real data).") Computes delta_x(VAR) between a baseline and a transformed result while returning diagnostics.
audit_transform( df, geo_col, var_col, steps, baseline_filter = NULL, target_id = NULL )audit_transform( df, geo_col, var_col, steps, baseline_filter = NULL, target_id = NULL )
df |
Input data frame. |
geo_col |
Column containing geography IDs. |
var_col |
Column containing the variable of interest. |
steps |
A list of step functions created by step_* helpers. |
baseline_filter |
Optional function(df) -> filtered df defining baseline membership. |
target_id |
Optional target ID to extract after final step (e.g., "27053"). |
An object of class audit_result.
Normalize messy geography headers to standard names
clean_geo_headers(df, map, keep)clean_geo_headers(df, map, keep)
df |
A data frame with geography columns. |
map |
Named character vector: names are standardized outputs, values are regex patterns of accepted input names. |
keep |
Character vector of standardized columns to keep. |
A tibble with standardized names.
Standardizes HUD crosswalk fields and enforces string IDs.
prep_hud_crosswalk(data, ratio_col = "TOT_RATIO")prep_hud_crosswalk(data, ratio_col = "TOT_RATIO")
data |
Raw HUD crosswalk data frame. |
ratio_col |
Which HUD ratio to use (default: "TOT_RATIO"). |
Tibble with columns: zip, county, tot_ratio.
Given an association table mapping ZCTAs to ZIPs, allocate each ZCTA's values equally across its associated ZIPs.
step_zcta_to_zip_equal(assoc, zcta_col = "zcta", zip_col = "zip")step_zcta_to_zip_equal(assoc, zcta_col = "zcta", zip_col = "zip")
assoc |
A data frame containing ZCTA-ZIP associations. |
zcta_col |
Column name in |
zip_col |
Column name in |
A step function suitable for audit_transform().
Allocate ZIP-level values to counties using HUD's TOT_RATIO weights.
step_zip_to_county_totratio( hud, zip_col = "zip", county_col = "county", weight_col = "tot_ratio" )step_zip_to_county_totratio( hud, zip_col = "zip", county_col = "county", weight_col = "tot_ratio" )
hud |
A data frame containing ZIP-to-county weights. |
zip_col |
Column name for ZIP (kept for API symmetry; cleaning is robust). |
county_col |
Column name for county (FIPS) (kept for API symmetry). |
weight_col |
Column name for the weight (default "tot_ratio") (kept for API symmetry). |
A step function suitable for audit_transform().