Skip to content

no variable labels or warning about the insufficiently selected variable filters #2

@e-kotov

Description

@e-kotov
library(mapineqr)
mi_source_filters("ghs_smod", year = 2020, level = "3")
# A tibble: 10 × 4
   field     field_label label                              value                             
   <chr>     <chr>       <chr>                              <chr>                             
 1 indicator indicator   DENSE URBAN CLUSTER GRID CELL      DENSE URBAN CLUSTER GRID CELL     
 2 indicator indicator   WATER GRID CELL                    WATER GRID CELL                   
 3 indicator indicator   SUBURBAN OR PERI-URBAN GRID CELL   SUBURBAN OR PERI-URBAN GRID CELL  
 4 indicator indicator   SEMI-DENSE URBAN CLUSTER GRID CELL SEMI-DENSE URBAN CLUSTER GRID CELL
 5 indicator indicator   VERY LOW DENSITY RURAL GRID CELL   VERY LOW DENSITY RURAL GRID CELL  
 6 indicator indicator   LOW DENSITY RURAL GRID CELL        LOW DENSITY RURAL GRID CELL       
 7 indicator indicator   RURAL CLUSTER GRID CELL            RURAL CLUSTER GRID CELL           
 8 indicator indicator   URBAN CENTRE GRID CELL             URBAN CENTRE GRID CELL            
 9 freq      freq        5 year                             5 year                            
10 unit      unit        km2                                km2       

As we can see, there are many different indicators we can (and should) choose to get the data.

If we do not set any filters:

x <- mi_data("ghs_smod", year = 2020, level = "3", limit = 50000)
x |> filter(geo == "AL011")

We get values for all those indicators such as "DENSE URBAN CLUSTER GRID CELL", "WATER GRID CELL", etc.

# A tibble: 8 × 4
  best_year geo   geo_name     x
  <chr>     <chr> <chr>    <int>
1 2018      AL011 Dibër        4
2 2018      AL011 Dibër        6
3 2018      AL011 Dibër       27
4 2018      AL011 Dibër      538
5 2018      AL011 Dibër        4
6 2018      AL011 Dibër        0
7 2018      AL011 Dibër       14
8 2018      AL011 Dibër     2525

Only by specifying the filter, we can find out which values is which:

mi_data("ghs_smod", year = 2020, level = "3",
  x_filters = list(indicator = "DENSE URBAN CLUSTER GRID CELL"), limit = 50000) |> 
  filter(geo == "AL011")
# A tibble: 1 × 4
  best_year geo   geo_name     x
  <chr>     <chr> <chr>    <int>
1 2018      AL011 Dibër        6

So in this case we know that we got the x value for "DENSE URBAN CLUSTER GRID CELL"

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions