The World Inequality Report 2022 (WIR2022) describes global trends in inequality. It mostly condense data in eight different regions. See the following graph as an example:
In this appendix I want to know the countries that form each of these eight regions.
A.1 Data
My first task was to look for data where I could extract the information I am interested in. I scanned the files of the free accessible GitHub repository of the WID. I found country-codes-core.xlsx, an Excel file with the data I am looking for. It is sorted by a two letter code in the first column named appropriately code. “Core” means – in contrast to other country-codes files – that it includes a column corecountry where the number 1 functions as a marker for a core country. The file itself has many hidden rows which feature either regions smaller than a country (like Alabama for US or Bavaria for Germany) or bigger than a country (like Asia or Western Europe).
Important
country-codes-core.xlsx contains many hidden rows. It is therefore necessary to filter by corecountry == 1.
A.1.1 Download data
The following code chunk is only applied once. It downloads the dataset, selects only the core countries and stores the file as country-code.RDS
R Code A.1 : Download the country-codes-core file, manipulate and save it
Code
## run this code chunk only once (manually)## define variablesurl<-"https://github.com/WIDworld/wid-world/raw/master/data-input/country-codes/country-codes-core.xlsx"chapter_folder="chap80"## create folder for chapter if not already donechap_folder<-base::paste0(here::here(),paste0("/data/", chapter_folder, "/"))if(!base::file.exists(chap_folder)){base::dir.create(chap_folder)}## get country-codes-core.xlsxdestfile<-base::paste0(chap_folder, "country-codes-core.xlsx")utils::download.file(url, destfile)tmp<-readxl::read_xlsx(destfile)country_codes<-tmp|>## filter for core countriesdplyr::filter(corecountry==1)|>## convert all region columns to factor variablesdplyr::mutate(dplyr::across(tidyselect::starts_with("region"), forcats::as_factor))## save cleaned datapb_save_data_file("chap80", country_codes, "country_codes.rds")
(For this R code chunk is no output available)
A.1.2 Eplore Data
An inspection of the data file shows that column region5 contains the regions used in WIR2022.
R Code A.2 : Explore Data
Code
country_codes<-base::readRDS("data/chap80/country_codes.rds")skimr::skim(country_codes)glue::glue(" ")glue::glue("############################################################")glue::glue("Display number of countries for each region")glue::glue("############################################################")glue::glue(" ")country_codes|>dplyr::pull(region5)|>forcats::fct_count()
Data summary
Name
country_codes
Number of rows
216
Number of columns
10
_______________________
Column type frequency:
character
3
factor
5
numeric
2
________________________
Group variables
None
Variable type: character
skim_variable
n_missing
complete_rate
min
max
empty
n_unique
whitespace
code
0
1
2
2
0
216
0
titlename
0
1
4
32
0
216
0
shortname
0
1
3
32
0
216
0
Variable type: factor
skim_variable
n_missing
complete_rate
ordered
n_unique
top_counts
region1
0
1.00
FALSE
5
Afr: 54, Asi: 53, Ame: 47, Eur: 46
region2
0
1.00
FALSE
18
Wes: 27, Car: 23, Wes: 20, Eas: 19
region3
184
0.15
FALSE
1
Eur: 32
region4
24
0.89
FALSE
9
Oth: 48, Oth: 38, Oth: 22, Oth: 18
region5
0
1.00
FALSE
8
Sub: 49, Eur: 46, Lat: 43, MEN: 20
Variable type: numeric
skim_variable
n_missing
complete_rate
mean
sd
p0
p25
p50
p75
p100
hist
corecountry
0
1
1.00
0.00
1
1
1
1
1
▁▁▇▁▁
TH
0
1
0.19
0.39
0
0
0
0
1
▇▁▁▁▂
#>
#> ############################################################
#> Display number of countries for each region
#> ############################################################
#>
#> # A tibble: 8 × 2
#> f n
#> <fct> <int>
#> 1 Europe 46
#> 2 MENA 20
#> 3 South & South-East Asia 20
#> 4 Latin America 43
#> 5 Russia & Central Asia 11
#> 6 Sub-Saharan Africa 49
#> 7 North America & Oceania 19
#> 8 East Asia 8
A.2 List countries
Code Collection A.1 : List countries for each regions used in WIR2022
#> # A tibble: 46 × 3
#> code shortname region5
#> <chr> <chr> <fct>
#> 1 AD Andorra Europe
#> 2 AL Albania Europe
#> 3 AT Austria Europe
#> 4 BA Bosnia and Herzegovina Europe
#> 5 BE Belgium Europe
#> 6 BG Bulgaria Europe
#> 7 CH Switzerland Europe
#> 8 CY Cyprus Europe
#> 9 CZ Czech Republic Europe
#> 10 DE Germany Europe
#> 11 DK Denmark Europe
#> 12 EE Estonia Europe
#> 13 ES Spain Europe
#> 14 FI Finland Europe
#> 15 FR France Europe
#> 16 GB United Kingdom Europe
#> 17 GG Guernsey Europe
#> 18 GI Gibraltar Europe
#> 19 GR Greece Europe
#> 20 HR Croatia Europe
#> 21 HU Hungary Europe
#> 22 IE Ireland Europe
#> 23 IM Isle of Man Europe
#> 24 IS Iceland Europe
#> 25 IT Italy Europe
#> 26 JE Jersey Europe
#> 27 KS Kosovo Europe
#> 28 LI Liechtenstein Europe
#> 29 LT Lithuania Europe
#> 30 LU Luxembourg Europe
#> 31 LV Latvia Europe
#> 32 MC Monaco Europe
#> 33 MD Moldova Europe
#> 34 ME Montenegro Europe
#> 35 MK North Macedonia Europe
#> 36 MT Malta Europe
#> 37 NL Netherlands Europe
#> 38 NO Norway Europe
#> 39 PL Poland Europe
#> 40 PT Portugal Europe
#> 41 RO Romania Europe
#> 42 RS Serbia Europe
#> 43 SE Sweden Europe
#> 44 SI Slovenia Europe
#> 45 SK Slovakia Europe
#> 46 SM San Marino Europe
R Code A.4 : Countries of the MENA region (Middle East & North Afrika)
#> # A tibble: 20 × 3
#> code shortname region5
#> <chr> <chr> <fct>
#> 1 AE United Arab Emirates MENA
#> 2 BH Bahrain MENA
#> 3 DZ Algeria MENA
#> 4 EG Egypt MENA
#> 5 IL Israel MENA
#> 6 IQ Iraq MENA
#> 7 IR Iran MENA
#> 8 JO Jordan MENA
#> 9 KW Kuwait MENA
#> 10 LB Lebanon MENA
#> 11 LY Libya MENA
#> 12 MA Morocco MENA
#> 13 OM Oman MENA
#> 14 PS Palestine MENA
#> 15 QA Qatar MENA
#> 16 SA Saudi Arabia MENA
#> 17 SY Syrian Arab Republic MENA
#> 18 TN Tunisia MENA
#> 19 TR Turkey MENA
#> 20 YE Yemen MENA
R Code A.5 : Countries of the South & South-East Asia region used in the WIR2022
#> # A tibble: 20 × 3
#> code shortname region5
#> <chr> <chr> <fct>
#> 1 AF Afghanistan South & South-East Asia
#> 2 BD Bangladesh South & South-East Asia
#> 3 BN Brunei Darussalam South & South-East Asia
#> 4 BT Bhutan South & South-East Asia
#> 5 ID Indonesia South & South-East Asia
#> 6 IN India South & South-East Asia
#> 7 KH Cambodia South & South-East Asia
#> 8 LA Lao PDR South & South-East Asia
#> 9 LK Sri Lanka South & South-East Asia
#> 10 MM Myanmar South & South-East Asia
#> 11 MV Maldives South & South-East Asia
#> 12 MY Malaysia South & South-East Asia
#> 13 NP Nepal South & South-East Asia
#> 14 PG Papua New Guinea South & South-East Asia
#> 15 PH Philippines South & South-East Asia
#> 16 PK Pakistan South & South-East Asia
#> 17 SG Singapore South & South-East Asia
#> 18 TH Thailand South & South-East Asia
#> 19 TL Timor-Leste South & South-East Asia
#> 20 VN Viet Nam South & South-East Asia
R Code A.6 : Countries of the Latin America region used in the WIR2022
#> # A tibble: 43 × 3
#> code shortname region5
#> <chr> <chr> <fct>
#> 1 AG Antigua and Barbuda Latin America
#> 2 AI Anguilla Latin America
#> 3 AR Argentina Latin America
#> 4 AW Aruba Latin America
#> 5 BB Barbados Latin America
#> 6 BO Bolivia Latin America
#> 7 BQ Bonaire, Sint Eustatius and Saba Latin America
#> 8 BR Brazil Latin America
#> 9 BS Bahamas Latin America
#> 10 BZ Belize Latin America
#> 11 CL Chile Latin America
#> 12 CO Colombia Latin America
#> 13 CR Costa Rica Latin America
#> 14 CU Cuba Latin America
#> 15 CW Curacao Latin America
#> 16 DM Dominica Latin America
#> 17 DO Dominican Republic Latin America
#> 18 EC Ecuador Latin America
#> 19 GD Grenada Latin America
#> 20 GT Guatemala Latin America
#> 21 GY Guyana Latin America
#> 22 HN Honduras Latin America
#> 23 HT Haiti Latin America
#> 24 JM Jamaica Latin America
#> 25 KN Saint Kitts and Nevis Latin America
#> 26 KY Cayman Islands Latin America
#> 27 LC Saint Lucia Latin America
#> 28 MS Montserrat Latin America
#> 29 MX Mexico Latin America
#> 30 NI Nicaragua Latin America
#> 31 PA Panama Latin America
#> 32 PE Peru Latin America
#> 33 PR Puerto Rico Latin America
#> 34 PY Paraguay Latin America
#> 35 SR Suriname Latin America
#> 36 SV El Salvador Latin America
#> 37 SX Sint Maarten (Dutch part) Latin America
#> 38 TC Turks and Caicos Islands Latin America
#> 39 TT Trinidad and Tobago Latin America
#> 40 UY Uruguay Latin America
#> 41 VC Saint Vincent and the Grenadines Latin America
#> 42 VE Venezuela Latin America
#> 43 VG Virgin Islands, British Latin America
R Code A.7 : Countries of the Russia & Central Asia region used in the WIR2022
Code
wir2022_country_codes|>dplyr::filter(region5=="Russia & Central Asia")|>print(n =50)
#> # A tibble: 11 × 3
#> code shortname region5
#> <chr> <chr> <fct>
#> 1 AM Armenia Russia & Central Asia
#> 2 AZ Azerbaijan Russia & Central Asia
#> 3 BY Belarus Russia & Central Asia
#> 4 GE Georgia Russia & Central Asia
#> 5 KG Kyrgyzstan Russia & Central Asia
#> 6 KZ Kazakhstan Russia & Central Asia
#> 7 RU Russian Federation Russia & Central Asia
#> 8 TJ Tajikistan Russia & Central Asia
#> 9 TM Turkmenistan Russia & Central Asia
#> 10 UA Ukraine Russia & Central Asia
#> 11 UZ Uzbekistan Russia & Central Asia
R Code A.8 : Countries of the Sub-Saharan African region used in the WIR2022
#> # A tibble: 49 × 3
#> code shortname region5
#> <chr> <chr> <fct>
#> 1 AO Angola Sub-Saharan Africa
#> 2 BF Burkina Faso Sub-Saharan Africa
#> 3 BI Burundi Sub-Saharan Africa
#> 4 BJ Benin Sub-Saharan Africa
#> 5 BW Botswana Sub-Saharan Africa
#> 6 CD DR Congo Sub-Saharan Africa
#> 7 CF Central African Republic Sub-Saharan Africa
#> 8 CG Congo Sub-Saharan Africa
#> 9 CI Cote d'Ivoire Sub-Saharan Africa
#> 10 CM Cameroon Sub-Saharan Africa
#> 11 CV Cabo Verde Sub-Saharan Africa
#> 12 DJ Djibouti Sub-Saharan Africa
#> 13 ER Eritrea Sub-Saharan Africa
#> 14 ET Ethiopia Sub-Saharan Africa
#> 15 GA Gabon Sub-Saharan Africa
#> 16 GH Ghana Sub-Saharan Africa
#> 17 GM Gambia Sub-Saharan Africa
#> 18 GN Guinea Sub-Saharan Africa
#> 19 GQ Equatorial Guinea Sub-Saharan Africa
#> 20 GW Guinea-Bissau Sub-Saharan Africa
#> 21 KE Kenya Sub-Saharan Africa
#> 22 KM Comoros Sub-Saharan Africa
#> 23 LR Liberia Sub-Saharan Africa
#> 24 LS Lesotho Sub-Saharan Africa
#> 25 MG Madagascar Sub-Saharan Africa
#> 26 ML Mali Sub-Saharan Africa
#> 27 MR Mauritania Sub-Saharan Africa
#> 28 MU Mauritius Sub-Saharan Africa
#> 29 MW Malawi Sub-Saharan Africa
#> 30 MZ Mozambique Sub-Saharan Africa
#> 31 NA Namibia Sub-Saharan Africa
#> 32 NE Niger Sub-Saharan Africa
#> 33 NG Nigeria Sub-Saharan Africa
#> 34 RW Rwanda Sub-Saharan Africa
#> 35 SC Seychelles Sub-Saharan Africa
#> 36 SD Sudan Sub-Saharan Africa
#> 37 SL Sierra Leone Sub-Saharan Africa
#> 38 SN Senegal Sub-Saharan Africa
#> 39 SO Somalia Sub-Saharan Africa
#> 40 SS South Sudan Sub-Saharan Africa
#> 41 ST Sao Tome and Principe Sub-Saharan Africa
#> 42 SZ Swaziland Sub-Saharan Africa
#> 43 TD Chad Sub-Saharan Africa
#> 44 TG Togo Sub-Saharan Africa
#> 45 TZ Tanzania Sub-Saharan Africa
#> 46 UG Uganda Sub-Saharan Africa
#> 47 ZA South Africa Sub-Saharan Africa
#> 48 ZM Zambia Sub-Saharan Africa
#> 49 ZW Zimbabwe Sub-Saharan Africa
R Code A.9 : Countries of the North America & Oceania region used in the WIR2022
Code
wir2022_country_codes|>dplyr::filter(region5=="North America & Oceania")|>print(n =50)
#> # A tibble: 19 × 3
#> code shortname region5
#> <chr> <chr> <fct>
#> 1 AU Australia North America & Oceania
#> 2 BM Bermuda North America & Oceania
#> 3 CA Canada North America & Oceania
#> 4 FJ Fiji North America & Oceania
#> 5 FM Micronesia North America & Oceania
#> 6 GL Greenland North America & Oceania
#> 7 KI Kiribati North America & Oceania
#> 8 MH Marshall Islands North America & Oceania
#> 9 NC New Caledonia North America & Oceania
#> 10 NR Nauru North America & Oceania
#> 11 NZ New Zealand North America & Oceania
#> 12 PF French Polynesia North America & Oceania
#> 13 PW Palau North America & Oceania
#> 14 SB Solomon Islands North America & Oceania
#> 15 TO Tonga North America & Oceania
#> 16 TV Tuvalu North America & Oceania
#> 17 US USA North America & Oceania
#> 18 VU Vanuatu North America & Oceania
#> 19 WS Samoa North America & Oceania
R Code A.10 : Countries of the East Asia region used in the WIR2022
#> # A tibble: 8 × 3
#> code shortname region5
#> <chr> <chr> <fct>
#> 1 CN China East Asia
#> 2 HK Hong Kong East Asia
#> 3 JP Japan East Asia
#> 4 KP North Korea East Asia
#> 5 KR Korea East Asia
#> 6 MN Mongolia East Asia
#> 7 MO Macao East Asia
#> 8 TW Taiwan East Asia
# Regions and their Countries {#sec-countries-in-regions}```{r}#| label: setup#| results: hold#| include: falsebase::source(file =paste0(here::here(), "/R/helper.R"))ggplot2::theme_set(ggplot2::theme_bw())options(show.signif.stars =FALSE)```## Table of content {.unnumbered}::::: {#obj-chapter-template}:::: {.my-objectives}::: {.my-objectives-header}List regions of the WIR2022 and their countries:::::: {.my-objectives-container}The World Inequality Report 2022 (WIR2022) describes global trends in inequality. It mostly condense data in eight different regions. See the following graph as an example:![A typical example for a graph in the World Inequality Report 2022 (WIR2022), showing the division of the world into eight different world regions ("MENA" stands for Middle East & North Arfica).](img/80-WIR2022-min.png){#fig-80-wir2022-example fig-alt="The image shows the income shares for the bottom 50%, middle 40% and top 10% in 2021 dividing the world into eight different regions. With the exception of Europe the top 10% earn the biggest share of the income with the following order from lowest to the highest 10%: Europe, East Asia, North America, Russia & Central Asia, South & South-East Asia, Latin America, Sub-Saharan Africa, MENA (Middle East & North Africa). Example: In Latin America the top 10% captures 55% of national income compared to 36% of Europe." fig-align="center" width="100%"}In this appendix I want to know the countries that form each of these eight regions. ::::::::::::## DataMy first task was to look for data where I could extract the information I am interested in. I scanned the files of the free accessible [GitHub repository of the WID](https://github.com/WIDworld/wid-world). I found `country-codes-core.xlsx`, an Excel file with the data I am looking for. It is sorted by a two letter code in the first column named appropriately `code`. "Core" means -- in contrast to [other `country-codes` files](https://github.com/WIDworld/wid-world/tree/master/data-input/country-codes) -- that it includes a column `corecountry` where the number `1` functions as a marker for a core country. The file itself has many hidden rows which feature either regions smaller than a country (like Alabama for US or Bavaria for Germany) or bigger than a country (like Asia or Western Europe).::: {.callout-important}`country-codes-core.xlsx` contains many hidden rows. It is therefore necessary to filter by `corecountry == 1`.:::### Download dataThe following code chunk is only applied once. It downloads the dataset, selects only the core countries and stores the file as `country-code.RDS`:::::{.my-r-code}:::{.my-r-code-header}:::::: {#cnj-80-download-country-codes-core}: Download the country-codes-core file, manipulate and save it:::::::::::::{.my-r-code-container}```{r}#| label: download-country-codes-core#| eval: false## run this code chunk only once (manually)## define variablesurl <-"https://github.com/WIDworld/wid-world/raw/master/data-input/country-codes/country-codes-core.xlsx"chapter_folder ="chap80"## create folder for chapter if not already donechap_folder <- base::paste0( here::here(),paste0("/data/", chapter_folder, "/") )if (!base::file.exists(chap_folder)) {base::dir.create(chap_folder)}## get country-codes-core.xlsxdestfile <- base::paste0(chap_folder, "country-codes-core.xlsx")utils::download.file(url, destfile)tmp <- readxl::read_xlsx(destfile)country_codes <- tmp |>## filter for core countries dplyr::filter(corecountry ==1) |>## convert all region columns to factor variables dplyr::mutate(dplyr::across( tidyselect::starts_with("region"), forcats::as_factor) )## save cleaned datapb_save_data_file("chap80", country_codes, "country_codes.rds")```(*For this R code chunk is no output available*):::::::::### Eplore DataAn inspection of the data file shows that column `region5` contains the regions used in WIR2022.:::::{.my-r-code}:::{.my-r-code-header}:::::: {#cnj-80-explore-data}: Explore Data:::::::::::::{.my-r-code-container}```{r}#| label: explore-data#| results: holdcountry_codes <- base::readRDS("data/chap80/country_codes.rds")skimr::skim(country_codes)glue::glue(" ")glue::glue("############################################################")glue::glue("Display number of countries for each region")glue::glue("############################################################")glue::glue(" ")country_codes |> dplyr::pull(region5) |> forcats::fct_count()```:::::::::## List countries:::::{.my-example}:::{.my-example-header}:::::: {#exm-80-list-countries}: List countries for each regions used in WIR2022:::::::::::::{.my-example-container}::: {.panel-tabset}###### Europe:::::{.my-r-code}:::{.my-r-code-header}:::::: {#cnj-80-europe}: Countries of the European region used in the WIR2022:::::::::::::{.my-r-code-container}```{r}#| label: europe#| results: holdwir2022_country_codes <- country_codes |> dplyr::select(code, shortname, region5)wir2022_country_codes |> dplyr::filter(region5 =="Europe") |>print(n =50)```:::::::::###### MENA:::::{.my-r-code}:::{.my-r-code-header}:::::: {#cnj-80-mena}: Countries of the MENA region (Middle East & North Afrika):::::::::::::{.my-r-code-container}```{r}#| label: menawir2022_country_codes |> dplyr::filter(region5 =="MENA") |>print(n =50)```:::::::::###### South & South-East Asia:::::{.my-r-code}:::{.my-r-code-header}:::::: {#cnj-80-ssea}: Countries of the South & South-East Asia region used in the WIR2022:::::::::::::{.my-r-code-container}```{r}#| label: sseawir2022_country_codes |> dplyr::filter(region5 =="South & South-East Asia") |>print(n =50)```:::::::::###### Latin America:::::{.my-r-code}:::{.my-r-code-header}:::::: {#cnj-80-latin-america}: Countries of the Latin America region used in the WIR2022:::::::::::::{.my-r-code-container}```{r}#| label: latin-americawir2022_country_codes |> dplyr::filter(region5 =="Latin America") |>print(n =50)```:::::::::###### Russia & Central Asia:::::{.my-r-code}:::{.my-r-code-header}:::::: {#cnj-80-ruca}: Countries of the Russia & Central Asia region used in the WIR2022:::::::::::::{.my-r-code-container}```{r}#| label: rucawir2022_country_codes |> dplyr::filter(region5 =="Russia & Central Asia") |>print(n =50)```:::::::::###### Sub-Saharan Africa:::::{.my-r-code}:::{.my-r-code-header}:::::: {#cnj-80-susa}: Countries of the Sub-Saharan African region used in the WIR2022:::::::::::::{.my-r-code-container}```{r}#| label: susawir2022_country_codes |> dplyr::filter(region5 =="Sub-Saharan Africa") |>print(n =50)```:::::::::###### North America & Oceania:::::{.my-r-code}:::{.my-r-code-header}:::::: {#cnj-80-noac}: Countries of the North America & Oceania region used in the WIR2022:::::::::::::{.my-r-code-container}```{r}#| label: noacwir2022_country_codes |> dplyr::filter(region5 =="North America & Oceania") |>print(n =50)```:::::::::###### East Asia:::::{.my-r-code}:::{.my-r-code-header}:::::: {#cnj-80-east-asia}: Countries of the East Asia region used in the WIR2022:::::::::::::{.my-r-code-container}```{r}#| label: east-asiawir2022_country_codes |> dplyr::filter(region5 =="East Asia") |>print(n =50)```:::::::::::::::::::::***