Introduction

2022-02-22

rgho is an R package to access WHO GHO data from R via the Athena web service, an API providing a simple query interface to the World Health Organization’s data and statistics content.

The Global Health Observatory

As stated by the WHO website: The GHO data repository contains an extensive list of indicators, which can be selected by theme or through a multi-dimension query functionality. It is the World Health Organization’s main health statistics repository.

Data structure

GHO data is composed of indicators structured in dimensions. The list of dimensions is available in vignette("b-dimensions", "rgho"), the list of indicators for the GHO dimension (the main dimension) in vignette("c-codes-gho", "rgho")).

It is possible to access dimensions with get_gho_dimensions():

get_gho_dimensions()
## New names:
## * `` -> ...1
## * `` -> ...2
## * `` -> ...3
## A 'GHO' object of 150 elements.
## 
##                                  Label                ID
## 1    SUBSTANCE_ABUSE_ADVERTISING_TYPES   ADVERTISINGTYPE
## 2                            Age Group          AGEGROUP
## 3                          Action area     ALCACTIONAREA
## 4 SUBSTANCE_ABUSE_ALCOHOL_POLICY_YEARS ALCOHOLPOLICYYEAR
## 5                       Beverage Types       ALCOHOLTYPE
## 6                   AMR GLASS Category  AMRGLASSCATEGORY
## ...
## 
## (Printing 6 first elements.)

And codes for a given dimension with get_gho_codes():

get_gho_codes(dimension = "COUNTRY")
## New names:
## * `` -> ...1
## * `` -> ...2
## * `` -> ...3
## New names:
## * `` -> ...3
## A 'GHO' object of 249 elements.
## 
##         Label  ID
## 1       Aruba ABW
## 2 Afghanistan AFG
## 3      Angola AGO
## 4    Anguilla AIA
## 5     Albania ALB
## 6     Andorra AND
## ...
## 
## (Printing 6 first elements.)
## 
## Attributes:
## 
## DS
## FIPS
## GEOMETRY
## IOC
## ISO
## ISO2
## ITU
## LAND_AREA_KMSQ_2012
## LANGUAGES_EN_2012
## MARC
## MORT
## SHORTNAMEES
## SHORTNAMEFR
## WHO
## WHOLEGALSTATUS
## WHO_REGION
## WHO_REGION_CODE
## WMO
## WORLD_BANK_INCOME_GROUP
## WORLD_BANK_INCOME_GROUP_CODE
## WORLD_BANK_INCOME_GROUP_GNI_REFERENCE_YEAR
## WORLD_BANK_INCOME_GROUP_RELEASE_DATE
get_gho_codes(dimension = "GHO")
## New names:
## * `` -> ...1
## * `` -> ...2
## * `` -> ...3
## New names:
## * `` -> ...3
## A 'GHO' object of 2867 elements.
## 
##                                                                            Label
## 1                                      Ambient air pollution attributable deaths
## 2    Ambient air pollution attributable DALYs per 100'000 children under 5 years
## 3                                    Household air pollution attributable deaths
## 4          Household air pollution attributable deaths in children under 5 years
## 5                 Household air pollution attributable deaths per 100'000 capita
## 6 Household air pollution attributable deaths per 100'000 children under 5 years
##       ID
## 1  AIR_1
## 2 AIR_10
## 3 AIR_11
## 4 AIR_12
## 5 AIR_13
## 6 AIR_14
## ...
## 
## (Printing 6 first elements.)
## 
## Attributes:
## 
## CATEGORY
## DEFINITION_XML
## DISPLAY_ES
## DISPLAY_FR
## IMR_ID
## RENDERER_ID

The number of printed items can be changed by the option rgho.n.

Filtering results

Dimension codes can be filtered according to their attributes.

results <- get_gho_codes(dimension = "COUNTRY")
## New names:
## * `` -> ...1
## * `` -> ...2
## * `` -> ...3
## New names:
## * `` -> ...3
filter_gho(
  results,
  WHO_REGION_CODE == "EUR"
)
## A 'GHO' object of 53 elements.
## 
##        Label  ID
## 1    Albania ALB
## 2    Andorra AND
## 3    Armenia ARM
## 4    Austria AUT
## 5 Azerbaijan AZE
## 6    Belgium BEL
## ...
## 
## (Printing 6 first elements.)
## 
## Attributes:
## 
## DS
## FIPS
## GEOMETRY
## IOC
## ISO
## ISO2
## ITU
## LAND_AREA_KMSQ_2012
## LANGUAGES_EN_2012
## MARC
## MORT
## SHORTNAMEES
## SHORTNAMEFR
## WHO
## WHOLEGALSTATUS
## WHO_REGION
## WHO_REGION_CODE
## WMO
## WORLD_BANK_INCOME_GROUP
## WORLD_BANK_INCOME_GROUP_CODE
## WORLD_BANK_INCOME_GROUP_GNI_REFERENCE_YEAR
## WORLD_BANK_INCOME_GROUP_RELEASE_DATE

Attribute names and values can be displayed.

display_attributes(
  results
)
##  [1] "code"                                      
##  [2] "DS"                                        
##  [3] "FIPS"                                      
##  [4] "GEOMETRY"                                  
##  [5] "IOC"                                       
##  [6] "ISO"                                       
##  [7] "ISO2"                                      
##  [8] "ITU"                                       
##  [9] "LAND_AREA_KMSQ_2012"                       
## [10] "LANGUAGES_EN_2012"                         
## [11] "MARC"                                      
## [12] "MORT"                                      
## [13] "SHORTNAMEES"                               
## [14] "SHORTNAMEFR"                               
## [15] "WHO"                                       
## [16] "WHOLEGALSTATUS"                            
## [17] "WHO_REGION"                                
## [18] "WHO_REGION_CODE"                           
## [19] "WMO"                                       
## [20] "WORLD_BANK_INCOME_GROUP"                   
## [21] "WORLD_BANK_INCOME_GROUP_CODE"              
## [22] "WORLD_BANK_INCOME_GROUP_GNI_REFERENCE_YEAR"
## [23] "WORLD_BANK_INCOME_GROUP_RELEASE_DATE"
display_attribute_values(
  results,
  "WHO_REGION_CODE"
)
## [1] "AFR"  "AMR"  "EMR"  "EUR"  "SEAR" "WPR"

Data download

An indicator can be downloaded as a data_frame with get_gho_data(). Here we use MDG_0000000001, Infant mortality rate (probability of dying between birth and age 1 per 1000 live births):

result <- get_gho_data(
  dimension = "GHO",
  code = "MDG_0000000001"
)
## New names:
## * `` -> ...1
## * `` -> ...2
## * `` -> ...3
## New names:
## * `` -> ...1
## * `` -> ...2
## * `` -> ...3
## New names:
## * `` -> ...3
## Rows: 35933 Columns: 13
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (6): GHO, PUBLISHSTATE, REGION, COUNTRY, SEX, Display Value
## dbl (4): YEAR, Numeric, Low, High
## lgl (3): StdErr, StdDev, Comments
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
print(result, width = Inf)
## # A tibble: 35,933 × 13
##    GHO            PUBLISHSTATE  YEAR REGION COUNTRY SEX   `Display Value`    
##    <chr>          <chr>        <dbl> <chr>  <chr>   <chr> <chr>              
##  1 MDG_0000000001 PUBLISHED     2013 AFR    <NA>    BTSX  58.78 [56.58-61.51]
##  2 MDG_0000000001 PUBLISHED     2013 AFR    <NA>    MLE   64.26 [61.82-67.33]
##  3 MDG_0000000001 PUBLISHED     2015 AFR    <NA>    FMLE  50.54 [48.23-53.76]
##  4 MDG_0000000001 PUBLISHED     2016 AFR    <NA>    BTSX  54.69 [51.92-58.55]
##  5 MDG_0000000001 PUBLISHED     2018 AFR    <NA>    FMLE  46.83 [43.92-51.27]
##  6 MDG_0000000001 PUBLISHED     2019 AFR    <NA>    BTSX  50.72 [47.34-56.09]
##  7 MDG_0000000001 PUBLISHED     1990 AMR    <NA>    FMLE  30.71 [29.85-31.65]
##  8 MDG_0000000001 PUBLISHED     1991 AMR    <NA>    BTSX  32.94 [32.16-33.76]
##  9 MDG_0000000001 PUBLISHED     1992 AMR    <NA>    MLE   34.74 [33.83-35.72]
## 10 MDG_0000000001 PUBLISHED     1993 AMR    <NA>    FMLE  27.12 [26.37-27.93]
##    Numeric   Low  High StdErr StdDev Comments
##      <dbl> <dbl> <dbl> <lgl>  <lgl>  <lgl>   
##  1    58.8  56.6  61.5 NA     NA     NA      
##  2    64.3  61.8  67.3 NA     NA     NA      
##  3    50.5  48.2  53.8 NA     NA     NA      
##  4    54.7  51.9  58.5 NA     NA     NA      
##  5    46.8  43.9  51.3 NA     NA     NA      
##  6    50.7  47.3  56.1 NA     NA     NA      
##  7    30.7  29.8  31.7 NA     NA     NA      
##  8    32.9  32.2  33.8 NA     NA     NA      
##  9    34.7  33.8  35.7 NA     NA     NA      
## 10    27.1  26.4  27.9 NA     NA     NA      
## # … with 35,923 more rows

Filter requests

The filter argument in get_gho_data() allows request filtering:

result <- get_gho_data(
  dimension = "GHO",
  code = "MDG_0000000001",
  filter = list(
    REGION = "EUR",
    YEAR = "2015"
  )
)
## New names:
## * `` -> ...1
## * `` -> ...2
## * `` -> ...3
## New names:
## * `` -> ...1
## * `` -> ...2
## * `` -> ...3
## New names:
## * `` -> ...3
## Rows: 162 Columns: 13
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (6): GHO, PUBLISHSTATE, REGION, COUNTRY, SEX, Display Value
## dbl (4): YEAR, Numeric, Low, High
## lgl (3): StdErr, StdDev, Comments
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
print(result, width = Inf)
## # A tibble: 162 × 13
##    GHO            PUBLISHSTATE  YEAR REGION COUNTRY SEX   `Display Value`    
##    <chr>          <chr>        <dbl> <chr>  <chr>   <chr> <chr>              
##  1 MDG_0000000001 PUBLISHED     2015 EUR    <NA>    BTSX  8.0 [7.76-8.28]    
##  2 MDG_0000000001 PUBLISHED     2015 EUR    <NA>    FMLE  7.11 [6.89-7.37]   
##  3 MDG_0000000001 PUBLISHED     2015 EUR    <NA>    MLE   8.85 [8.57-9.17]   
##  4 MDG_0000000001 PUBLISHED     2015 EUR    ALB     BTSX  8.5 [8.19-8.83]    
##  5 MDG_0000000001 PUBLISHED     2015 EUR    ALB     FMLE  7.57 [7.21-7.95]   
##  6 MDG_0000000001 PUBLISHED     2015 EUR    ALB     MLE   9.39 [8.98-9.8]    
##  7 MDG_0000000001 PUBLISHED     2015 EUR    AND     BTSX  3.11 [2.24-4.32]   
##  8 MDG_0000000001 PUBLISHED     2015 EUR    AND     FMLE  2.77 [1.98-3.88]   
##  9 MDG_0000000001 PUBLISHED     2015 EUR    AND     MLE   3.42 [2.45-4.78]   
## 10 MDG_0000000001 PUBLISHED     2015 EUR    ARM     BTSX  12.59 [10.29-15.01]
##    Numeric   Low  High StdErr StdDev Comments
##      <dbl> <dbl> <dbl> <lgl>  <lgl>  <lgl>   
##  1    8.00  7.76  8.28 NA     NA     NA      
##  2    7.11  6.89  7.37 NA     NA     NA      
##  3    8.85  8.57  9.17 NA     NA     NA      
##  4    8.50  8.19  8.83 NA     NA     NA      
##  5    7.57  7.21  7.95 NA     NA     NA      
##  6    9.39  8.98  9.80 NA     NA     NA      
##  7    3.11  2.24  4.32 NA     NA     NA      
##  8    2.77  1.98  3.88 NA     NA     NA      
##  9    3.42  2.45  4.78 NA     NA     NA      
## 10   12.6  10.3  15.0  NA     NA     NA      
## # … with 152 more rows

Other parameters

Other parameters than format can be specified to get_gho_data() (such as apikey, asof…). Parameters are listed on this page. Note that most parameters are not available to general users.

For details about how the requests are performed and the option availables (especially proxy settings) see vignette("e-details", "rgho").