Resolve hex variable names against the registry
use_hex_vars.RdTakes canonical variable names (unquoted, quoted, or both via `...`) and returns a list of `pti_hex_var` descriptors ready to pass to `fetch_hex_data()`. **Always injects the population variable** (tagged `internal = TRUE`) regardless of what the deployer requests – downstream aggregation needs it.
Arguments
- ...
Canonical variable names. Either bare symbols, quoted strings, or a mix. Duplicates are removed silently. Pass no names to get just the auto-injected population variable.
- years
Optional integer vector of requested years for temporal variables. Stored on each `pti_hex_var` for the year resolver in [fetch_hex_data()] (arch-11 §"Year resolution" / issue #110) to consult; this function does **not** resolve nearest-year substitutions itself.
Value
A list of `pti_hex_var` objects, named by their (possibly suffixed) canonical name. Population always appears in the list, tagged `internal = TRUE`.
Details
When the same canonical name appears in multiple sources, the returned descriptor's `canonical_name` is suffixed with `__<source-label>` (e.g. `poverty_rate__DEC`, `poverty_rate__local`) so each becomes a distinct entry in the returned list and a distinct row downstream in `metadata-hex.xlsx`.
See also
[list_hex_vars()] to browse what is available; [get_available_years()] to confirm temporal coverage.
Other data-input:
aggregate_hex_to_shapes(),
build_hex_metadata(),
fct_template_reader(),
fetch_hex_data(),
get_available_years(),
get_shape(),
list_hex_vars(),
make_admin_lookup(),
make_hex_grid(),
pti_patch_admin_sheet()
Examples
if (FALSE) { # \dontrun{
# Resolve a single variable; population is auto-injected.
vars <- use_hex_vars("flood_exposure_15cm_1in100")
names(vars)
# Pass a year hint for temporal variables (year resolver runs in
# fetch_hex_data() per arch-11 #110).
vars <- use_hex_vars("flood_exposure_15cm_1in100", years = 2020L)
} # }