Skip to contents

Constructs a full crosswalk mapping PUMAs to zone groups via client zones, enabling aggregation and analysis by zone group. Use when joining PUMS or survey data to zone group geography for weighting or reporting.

Usage

create_full_xwalk(puma_client_zone_xwalk, zone_group_crosswalk)

Arguments

puma_client_zone_xwalk

data.table. PUMA to client zone crosswalk. Required columns:

  • puma <character/integer> — PUMA code

  • client_zone_id <character/integer> — client zone identifier Rows: one per PUMA-client zone. Keys: none required. Modified by reference: no (returns copy).

zone_group_crosswalk

data.table. Zone group crosswalk. Required columns:

  • client_zone_id <character/integer> — client zone identifier

  • zone_group <character/integer> — zone group identifier

  • zone_group_label — zone group label Rows: one per client zone. Keys: none required. Modified by reference: no (read-only).

Value

data.table. Full crosswalk mapping PUMAs to zone groups. Columns:

  • puma <character/integer> — PUMA code

  • client_zone_id <character/integer> — client zone identifier

  • zone_group <character/integer> — zone group identifier

  • zone_group_label — zone group label Rows: one per PUMA-client zone. Keys: none required.

Details

  • Copies and cleans input crosswalks to avoid reference modification.

  • Removes any zone group columns from PUMA-client zone crosswalk to prevent duplication.

  • Ensures client zone IDs are character type for consistent merging.

  • Merges PUMA-client zone and zone group crosswalks by client zone ID.

  • Labels outside-region client zones with zone_group = -1 and zone_group_label = "Outside region".

  • Checks for missing zone group assignments and errors if any are found.

  • Returns a data.table mapping each PUMA to its zone group and label.

Settings

None.

See also

calc_target_ci, calc_survey_ci

Examples

## Not run:
puma_client_zone_xwalk <- data.table(puma = "P1", client_zone_id = 1)
zone_group_crosswalk <- data.table(client_zone_id = 1, zone_group = 1, zone_group_label = "A")
create_full_xwalk(puma_client_zone_xwalk, zone_group_crosswalk)
#> Key: <client_zone_id>
#>    client_zone_id   puma zone_group zone_group_label
#>            <char> <char>      <num>           <char>
#> 1:              1     P1          1                A
## End(Not run)