Skip to contents

Returns the `(var_code, admin_level)` pairs for which the indicator has no native data at that admin level. Pairs are emitted symmetrically: an indicator with data only at admin1 surfaces as unavailable at admin2 / admin4 (and vice versa). Used as the first step in [mod_drop_inval_adm()] to decide which admin levels must be hidden for a given weighting.

Usage

get_vars_un_avbil(ind_list, admin_levels = NULL)

Arguments

ind_list

A tibble shaped like the output of the internal indicators-list pipeline – at minimum a `var_code` column and a list-column `admin_levels_years` whose elements describe per-admin data presence.

admin_levels

Optional character vector restricting the admin levels considered (e.g. `c("admin1", "admin2")`). Defaults to the sorted unique levels seen in `ind_list`.

Value

A tibble with one row per unavailable `(var_code, admin_level)` pair, with columns `var_code` and `admin_level`.

See also

Examples

# `ind_b` only has data at admin2 -- the function flags it as
# unavailable at admin1.
ind_list <- tibble::tibble(
  var_code = c("ind_a", "ind_b"),
  admin_levels_years = list(
    tibble::tibble(
      admin_level = c("admin1", "admin2"),
      admin_level_name = c("Oblast", "Rayon"),
      years = list(c(2020), c(2020, 2021))
    ),
    tibble::tibble(
      admin_level = "admin2",
      admin_level_name = "Rayon",
      years = list(c(2020))
    )
  )
)
get_vars_un_avbil(ind_list, admin_levels = c("admin1", "admin2"))
#> # A tibble: 1 × 2
#>   var_code admin_level
#>   <chr>    <chr>      
#> 1 ind_b    admin1