Filter Dataset by Geographic Region and Time Period
region_period_filter.RdEnhances and filters a repository dataset based on specified geographic regions and a defined time window. Regional information is added by merging with an external country-to-region mapping file.
Usage
region_period_filter(
repo,
geo = c("Africa-E", "Africa-W", "Americas", "Asia-Pacific", NA),
year_min = -Inf,
year_max = +Inf
)Arguments
- repo
A `data.frame` or tibble containing the input dataset. Must include a `country` column.
- geo
Character vector of region names to retain. Defaults to common WHO-defined macro-regions: `"Africa-E"`, `"Africa-W"`, `"Americas"`, `"Asia-Pacific"`, and `NA`.
- year_min
Integer or numeric. Minimum year to include (inclusive). Defaults to `-Inf` (no lower bound).
- year_max
Integer or numeric. Maximum year to include (inclusive). Defaults to `Inf` (no upper bound).