Introduction

2016-09-25

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()
## A 'GHO' object of 115 elements.
## 
##                                      Label                    ID
## 1        SUBSTANCE_ABUSE_ADVERTISING_TYPES       ADVERTISINGTYPE
## 2                                Age Group              AGEGROUP
## 3     SUBSTANCE_ABUSE_ALCOHOL_POLICY_YEARS     ALCOHOLPOLICYYEAR
## 4                           Beverage Types           ALCOHOLTYPE
## 5 SUBSTANCE_ABUSE_AWARENESS_ACTIVITY_TYPES AWARENESSACTIVITYTYPE
## 6               SUBSTANCE_ABUSE_BAC_GROUPS              BACGROUP
## ...
## 
## (Printing 6 first elements.)

And codes for a given dimension with get_gho_codes():

get_gho_codes(dimension = "COUNTRY")
## A 'GHO' object of 247 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")
## A 'GHO' object of 2224 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

Filtering results

Dimension codes can be filtered according to their attributes.

results <- get_gho_codes(dimension = "COUNTRY")

filter_attrs(
  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 values can be displayed.

values_attrs(
  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"
)

print(result, width = Inf)
## # A tibble: 5,330 × 11
##               GHO PUBLISHSTATE  YEAR REGION WORLDBANKINCOMEGROUP COUNTRY
##             <chr>        <chr> <int>  <chr>                <chr>   <chr>
## 1  MDG_0000000001    PUBLISHED  1990    AFR                WB_LI     BDI
## 2  MDG_0000000001    PUBLISHED  2004    AFR                WB_LI     BDI
## 3  MDG_0000000001    PUBLISHED  1998    AFR                WB_LI     BEN
## 4  MDG_0000000001    PUBLISHED  2004    AFR                WB_LI     BEN
## 5  MDG_0000000001    PUBLISHED  1996    AFR                WB_LI     BFA
## 6  MDG_0000000001    PUBLISHED  2012    AFR                WB_LI     BFA
## 7  MDG_0000000001    PUBLISHED  2013    AFR                WB_LI     BFA
## 8  MDG_0000000001    PUBLISHED  2004    AFR               WB_UMI     BWA
## 9  MDG_0000000001    PUBLISHED  2010    AFR               WB_UMI     BWA
## 10 MDG_0000000001    PUBLISHED  2012    AFR               WB_UMI     BWA
##       `Display Value` Numeric   Low  High Comments
##                 <chr>   <dbl> <dbl> <dbl>    <chr>
## 1  103.9 [95.2-113.8]   103.9  95.2 113.8     <NA>
## 2    82.9 [73.3-93.5]    82.9  73.3  93.5     <NA>
## 3    92.7 [87.4-98.6]    92.7  87.4  98.6     <NA>
## 4    80.8 [75.0-86.8]    80.8  75.0  86.8     <NA>
## 5  100.5 [95.6-105.6]   100.5  95.6 105.6     <NA>
## 6    65.4 [58.9-72.7]    65.4  58.9  72.7     <NA>
## 7    63.7 [56.6-72.0]    63.7  56.6  72.0     <NA>
## 8    49.1 [34.4-61.8]    49.1  34.4  61.8     <NA>
## 9    39.8 [23.5-58.2]    39.8  23.5  58.2     <NA>
## 10   38.2 [21.6-59.2]    38.2  21.6  59.2     <NA>
## # ... with 5,320 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"
  )
)

print(result, width = Inf)
## # A tibble: 54 × 11
##               GHO PUBLISHSTATE  YEAR REGION WORLDBANKINCOMEGROUP COUNTRY
##             <chr>        <chr> <int>  <chr>                <chr>   <chr>
## 1  MDG_0000000001    PUBLISHED  2015    EUR               WB_UMI     SRB
## 2  MDG_0000000001    PUBLISHED  2015    EUR                WB_HI     NLD
## 3  MDG_0000000001    PUBLISHED  2015    EUR               WB_UMI     MKD
## 4  MDG_0000000001    PUBLISHED  2015    EUR                WB_HI     FIN
## 5  MDG_0000000001    PUBLISHED  2015    EUR                WB_HI     AND
## 6  MDG_0000000001    PUBLISHED  2015    EUR               WB_UMI     ALB
## 7  MDG_0000000001    PUBLISHED  2015    EUR               WB_UMI     KAZ
## 8  MDG_0000000001    PUBLISHED  2015    EUR                WB_HI     CHE
## 9  MDG_0000000001    PUBLISHED  2015    EUR               WB_UMI     ROU
## 10 MDG_0000000001    PUBLISHED  2015    EUR                WB_HI     POL
##     `Display Value` Numeric   Low  High Comments
##               <chr>   <dbl> <dbl> <dbl>    <chr>
## 1     5.9 [4.9-7.0]     5.9   4.9   7.0     <NA>
## 2     3.2 [2.9-3.6]     3.2   2.9   3.6     <NA>
## 3     4.8 [2.7-7.2]     4.8   2.7   7.2     <NA>
## 4     1.9 [1.6-2.2]     1.9   1.6   2.2     <NA>
## 5     2.1 [1.3-3.5]     2.1   1.3   3.5     <NA>
## 6   12.5 [7.0-22.2]    12.5   7.0  22.2     <NA>
## 7  12.6 [10.8-14.6]    12.6  10.8  14.6     <NA>
## 8     3.4 [2.9-4.0]     3.4   2.9   4.0     <NA>
## 9    9.7 [8.7-10.9]     9.7   8.7  10.9     <NA>
## 10    4.5 [4.0-5.1]     4.5   4.0   5.1     <NA>
## # ... with 44 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 see vignette("e-details", "rgho").