Apply target-specific location exclusions to a data frame.
Source:R/location_exclusions.R
apply_target_location_exclusions.RdRemoves rows from a data frame based on target-specific excluded location abbreviations. Supports uniform exclusions (character vector applied to all targets) and target-specific exclusions (named list with target names as keys). Validates target names against hub-supported targets from the hub configuration. Filters on the "target" and "location" columns via anti-join.
Arguments
- data
Data frame with "target" and "location" columns.
- excluded_locations
NULL, character vector, or named list of US state/territory abbreviations to exclude. If a character vector, locations are excluded across all targets. If a named list, names should be target names (or "all" for global exclusions) mapping to character vectors of abbreviations.
- base_hub_path
Character, path to the forecast hub directory. Used to validate target names against hub-supported targets.