Country Classifications

Author

Peter Baumgartner

Published

2024-12-04 22:04

Preface

This is work in progress

At the moment (end of 2024) I am planning four chapters and one annex:

  • United Nations M49 geomscheme classification: 100% (finished)
  • World Bank classification: 95%
  • World Inequality Database (WID): 0%
  • World Happiness Report (WHR): 0%
  • Annex: Used Packages: 5%
WATCH OUT!

This is my personal learning material. It does not represent an accepted scientific standard nor is the text peer reviewed or otherwise accepted by the scientific community.

Content and Goals of this Book

I am motivated by three reasons to write this book:

  1. During my personal research with datasets from countries over the world (concretely working with data from the WID and WHR) I experienced the problem to analyse and represent this manifold data in a suitable way. With about 250 countries or regions one needs a categorization scheme to summarize the data into plausible groups.
  2. I noticed that there are not only different classification systems in place but moreover it was not always clear which countries or regions are member of these groups.
  3. I published this text and made it under the license CC BY-SA 4.0 free available because that forces me to become explicit and explain all my thoughts more carefully.

Glossary

I am using the {glossary} package (see A.1 Glossary) to create links to glossary entries . If you hover with your mouse over the double underlined links it opens an window with the appropriate glossary text. Try this example: IDA.

At the end of each chapter I have listed the glossary entries. Sometimes you will find the letter “x” at the end of a glossary abbreviation. The reason for this anomaly is a restriction of the {glossary} package: It displays wrong items if the same letter combination is used by another entry and comes first in my alphabetically sorted list of entries. My glossary has for instance the entry of “Cross Validated” which would produce a wrong entry because it include the “IDA” abbreviation.

If you fork the repo of this “Country Classsification” book then the glossary will not work out of the box. Load down the glossary.yml file from my glossary-pb GitHub repo, store it on your hard disk and change the path in the code chunk according to Listing / Output 1.

R Code 1 : Load glossary

Listing / Output 1: Install and load the glossary package with the appropriate glossary.yml file
## 1. Install the glossary package:
## https://debruine.github.io/glossary/

library(glossary)

## If you want to use my glossary.yml file:

## 1. fork my repo
##    https://github.com/petzi53/glossary-pb

## 2. Download the `glossary.yml` file from
##    https://github.com/petzi53/glossary-pb/blob/master/glossary.yml)

## 3. Store the file on your hard disk
##    and change the following path accordingly to your configuation

glossary::glossary_path("../glossary-pb/glossary.yml")
The glossary items are not taken uncritically!

The glossary is just my private learning vehicle. The entries are not intended as my suggestions for a textbook or other official accepted definitions. I have added many of the glossary entries when I was working through other books either taking their text passages or taken text via internet inquiries from other resources. Often I have added the source of glossary entry. Sometimes I have used abbreviation for central books I have used for my personal learning career, but I need still to provide a key what these short references mean.

R Code and Datasets

I am following mainly the Tidyverse Style Guide with two important exceptions inspired by Google’s R Style Guide:

  1. Qualify namespace.
  2. Start the name of private function with the abbreviation pb_.

Qualifying namespace

To qualify the namespace is important for my personal learning. Besides preventing conflicts with functions of identical names from different packages it helps me to learn (or remember) which function belongs to which package. I think this justifies the small overhead and helps to make R code chunks self-sufficient. (No previous package loading, or library calls in the setup chunk.)

To foster learning the relation between function and package I embrace the package name with curly brakes and format it in bold. Additionally I have added a special annex file “Used packages” with an alphabetically sorted list of short package descriptions.

I am using the package name (namespace) also for the default installation of base R packages. This wouldn’t be necessary but it helps me to understand where the base R functions come from. What follows is a list of base R packages of the system library included into every installation and attached (opened) by default:

  • {base}: The R Base Package
  • {datsets}: The R Datasets Package
  • {graphics}: The R Graphics Package
  • {grDevices}: The R Graphics Devices and Support for Colours and Fonts
  • {methods}: Formal Methods and Classes
  • {stats}: The R Stats Package
  • {utils}: The R Utils Package

When it is clear then I will follow the advice from Hadley Wickham:

When you call a function, you typically omit the names of data arguments, because they are used so commonly. If you override the default value of an argument, use the full name (tidyverse style guide).

Private functions

To facilitate my coding I have prepared some private functions. To get a visual clue that they are my own functions their names start with “pb_”. They are all collected in the file “R/helper.R” which is sourced at the top of every file (chapter).

My private functions are:

  • pb_create_folder(): create folder at path
  • pb_save_data_file(): save data file into “data” folder at path
  • pb_class_scheme(): list groups with its elements

You will find the descriptions of the parameters and the code with notes in the “helper.R” file.

Glossary

term definition
IDAx The International Development Association (IDA) is the part of the World Bank that helps the world’s low-income countries. IDA's grants and low-interest loans help countries invest in their futures, improve lives, and create safer, more prosperous communities around the world. (https://ida.worldbank.org/en/what-is-ida)
M49 The United Nations publication "Standard Country or Area Codes for Statistical Use" was originally published as Series M, No. 49 and is now commonly referred to as the M49 standard. M49 is a country/areas classification system prepared by the Statistics Division of the United Nations Secretariat primarily for use in its publications and databases.
WHR The World Happiness Reports are a partnership of Gallup, the Oxford Wellbeing Research Centre, the UN Sustainable Development Solutions Network, and the WHR’s Editorial Board. The report is produced under the editorial control of the WHR Editorial Board. The Reports reflects a worldwide demand for more attention to happiness and well-being as criteria for government policy. It reviews the state of happiness in the world today and shows how the science of happiness explains personal and national variations in happiness. (https://worldhappiness.report/about/)
WID The 'World Inequality Database' (WID) aims to provide open and convenient access to the most extensive available database on the historical evolution of the world distribution of income and wealth, both within countries and between countries. [WID.WORLD](https://wid.world/wid-world/)

Session Info

Session Info

Code
sessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#>  setting  value
#>  version  R version 4.4.2 (2024-10-31)
#>  os       macOS Sequoia 15.1.1
#>  system   x86_64, darwin20
#>  ui       X11
#>  language (EN)
#>  collate  en_US.UTF-8
#>  ctype    en_US.UTF-8
#>  tz       Europe/Vienna
#>  date     2024-12-04
#>  pandoc   3.5 @ /usr/local/bin/ (via rmarkdown)
#> 
#> ─ Packages ───────────────────────────────────────────────────────────────────
#>  package     * version    date (UTC) lib source
#>  cli           3.6.3      2024-06-21 [2] CRAN (R 4.4.1)
#>  colorspace    2.1-1      2024-07-26 [2] CRAN (R 4.4.0)
#>  commonmark    1.9.2      2024-10-04 [2] CRAN (R 4.4.1)
#>  curl          6.0.0      2024-11-05 [2] CRAN (R 4.4.1)
#>  digest        0.6.37     2024-08-19 [2] CRAN (R 4.4.1)
#>  evaluate      1.0.1      2024-10-10 [2] CRAN (R 4.4.1)
#>  fastmap       1.2.0      2024-05-15 [2] CRAN (R 4.4.0)
#>  glossary    * 1.0.0.9003 2024-08-05 [2] Github (debruine/glossary@05e4a61)
#>  glue          1.8.0      2024-09-30 [2] CRAN (R 4.4.1)
#>  htmltools     0.5.8.1    2024-04-04 [2] CRAN (R 4.4.0)
#>  htmlwidgets   1.6.4      2023-12-06 [2] CRAN (R 4.4.0)
#>  jsonlite      1.8.9      2024-09-20 [2] CRAN (R 4.4.1)
#>  kableExtra    1.4.0      2024-01-24 [2] CRAN (R 4.4.0)
#>  knitr         1.49       2024-11-08 [2] CRAN (R 4.4.1)
#>  lifecycle     1.0.4      2023-11-07 [2] CRAN (R 4.4.0)
#>  magrittr      2.0.3      2022-03-30 [2] CRAN (R 4.4.0)
#>  markdown      1.13       2024-06-04 [2] CRAN (R 4.4.0)
#>  munsell       0.5.1      2024-04-01 [2] CRAN (R 4.4.0)
#>  R6            2.5.1      2021-08-19 [2] CRAN (R 4.4.0)
#>  rlang         1.1.4      2024-06-04 [2] CRAN (R 4.4.0)
#>  rmarkdown     2.29       2024-11-04 [2] CRAN (R 4.4.1)
#>  rstudioapi    0.17.1     2024-10-22 [2] CRAN (R 4.4.1)
#>  rversions     2.1.2      2022-08-31 [2] CRAN (R 4.4.0)
#>  scales        1.3.0      2023-11-28 [2] CRAN (R 4.4.0)
#>  sessioninfo   1.2.2      2021-12-06 [2] CRAN (R 4.4.0)
#>  stringi       1.8.4      2024-05-06 [2] CRAN (R 4.4.0)
#>  stringr       1.5.1      2023-11-14 [2] CRAN (R 4.4.0)
#>  svglite       2.1.3      2023-12-08 [2] CRAN (R 4.4.0)
#>  systemfonts   1.1.0      2024-05-15 [2] CRAN (R 4.4.0)
#>  vctrs         0.6.5      2023-12-01 [2] CRAN (R 4.4.0)
#>  viridisLite   0.4.2      2023-05-02 [2] CRAN (R 4.4.0)
#>  xfun          0.49       2024-10-31 [2] CRAN (R 4.4.1)
#>  xml2          1.3.6      2023-12-04 [2] CRAN (R 4.4.0)
#>  yaml          2.3.10     2024-07-26 [2] CRAN (R 4.4.0)
#> 
#>  [1] /Library/Frameworks/R.framework/Versions/4.4-x86_64/library
#>  [2] /Library/Frameworks/R.framework/Versions/4.4-x86_64/Resources/library
#> 
#> ──────────────────────────────────────────────────────────────────────────────