The goal of worldhdi is to present Human Development Index Data from 1990-2022 in a tidy format. The data is sourced from the United Nations Development
Installation
You can install the development version of worldhdi from GitHub with:
# install.packages("devtools")
devtools::install_github("openwashdata/worldhdi")
## Run the following code in console if you don't have the packages
## install.packages(c("dplyr", "knitr", "readr", "stringr", "gt", "kableExtra"))
library(dplyr)
library(knitr)
library(readr)
library(stringr)
library(gt)
library(kableExtra)
library(tidyverse)
library(lubridate)
Alternatively, you can download the individual datasets as a CSV or XLSX file from the table below.
dataset | CSV | XLSX |
---|---|---|
worldhdi | Download CSV | Download XLSX |
Data
The package provides access to tidy human development index (HDI) for 193 countries from 1990-2022. The data is sourced from the United Nations Development Programme (UNDP)
library(worldhdi)
worldhdi
The dataset worldhdi
contains data about human development index (HDI) for 193 countries from 1990-2022. It has 210 observations and 17 variables
worldhdi |>
head(3) |>
gt::gt() |>
gt::as_raw_html()
hdi_rank | country | hdi_1990 | hdi_2000 | hdi_2010 | hdi_2015 | hdi_2019 | hdi_2020 | hdi_2021 | hdi_2022 | rank_change_2015_2022 | avg_growth_1990_2000 | avg_growth_2000_2010 | avg_growth_2010_2022 | avg_growth_1990_2022 | tier_hdi | iso3c |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
For an overview of the variable names, see the following table.
variable_name | variable_type | description |
---|---|---|
hdi_rank | double | World Rank in Human Development Index as of 2022 |
country | double | Official name of the country |
hdi_1990 | double | HDI in 1990 |
hdi_2000 | double | HDI in 2000 |
hdi_2010 | double | HDI in 2010 |
hdi_2015 | double | HDI in 2015 |
hdi_2019 | double | HDI in 2019 |
hdi_2020 | double | HDI in 2020 |
hdi_2021 | double | HDI in 2021 |
hdi_2022 | double | HDI in 2022 |
rank_change_2015_2022 | double | Change in rank from 2015 to 2022 |
avg_growth_1990_2000 | double | Average annual growth in country’s HDI between 1990-2000 |
avg_growth_2000_2010 | double | Average annual growth in country’s HDI between 2000-2010 |
avg_growth_2010_2022 | double | Average annual growth in country’s HDI between 2010-2022 |
avg_growth_1990_2022 | double | Average annual growth in country’s HDI between 1990-2022 |
tier_hdi | character | HDI Tier as defined by UNDP {Very high [0.8-1.0), High [0.7 - 0.8), Medium [0.55-0.7), Low (<0.55)} |
iso3c | character | ISO3 code for the country |
Example
library(worldhdi)
library(ggplot2)
library(rnaturalearthdata)
library(rnaturalearth)
# 2022 HDI worldwide
world <- ne_countries(scale = "medium", returnclass = "sf")
world_map_data <- world |> left_join(worldhdi, by = c("iso_a3" = "iso3c"))
hdi_colors <- c("#d73027", "#fc8d59", "#fee08b", "#fdae61", "#fdd49e", "#feedde",
"#d9ef8b", "#a6d96a", "#66bd63", "#1a9850", "#00441b", "#003300", "#001a00",
"#e0e0e0")
ggplot(data = world_map_data) +
geom_sf(aes(fill = cut(hdi_2022,
breaks = c(-Inf, 0.399, 0.449, 0.499, 0.549, 0.599, 0.649, 0.699,
0.749, 0.799, 0.849, 0.899, 0.950, Inf),
labels = c("≤ 0.399", "0.400–0.449", "0.450–0.499", "0.500–0.549",
"0.550–0.599", "0.600–0.649", "0.650–0.699",
"0.700–0.749", "0.750–0.799", "0.800–0.849",
"0.850–0.899", "0.900–0.950", "≥ 0.950")))) +
scale_fill_manual(values = hdi_colors, na.value = "gray90", name = "HDI 2022 Brackets") +
theme_minimal() +
labs(title = "World HDI (2022)") +
theme(axis.text = element_blank(),
axis.ticks = element_blank(),
panel.grid = element_blank())
Which countries saw the biggest increases in HDI over this period?
worldhdi |>
filter(!is.na(avg_growth_1990_2022)) |>
arrange(desc(avg_growth_1990_2022)) |>
select(country, avg_growth_1990_2022) |>
head(10) |>
gt::gt() |>
gt::as_raw_html()
country | avg_growth_1990_2022 |
---|---|
Trends in HDI by region
# Use the rows where country is Organisation for Economic Co-operation and Development,
# Arab States, East Asia and the Pacific, Europe and Central Asia, Latin America and the Caribbean, World and plot the hdi trends using hdi_1990, hdi_2000, hdi_2010, hdi_2015, hdi_2022
worldhdi |>
filter(country %in% c("Organisation for Economic Co-operation and Development",
"Arab States", "East Asia and the Pacific",
"Europe and Central Asia", "Latin America and the Caribbean", "World", "Sub-Saharan Africa", "South Asia")) |>
pivot_longer(cols = starts_with("hdi"),
names_to = "year",
values_to = "hdi") |>
mutate(year = gsub("hdi_", "", year), # Remove "hdi_" prefix
year = ymd(paste0(year, "-01-01")), # Convert to date format
country = ifelse(country == "Organisation for Economic Co-operation and Development", "OECD", country)) |>
ggplot(aes(x = year, y = hdi, group = country, color = country)) +
geom_line() +
geom_point() +
scale_x_date(date_labels = "%Y", date_breaks = "10 years") + # Format x-axis as date and show every 10 years
labs(title = "Trends in HDI by Region", y = "HDI", x = "Year", color = "Country") + # Set legend title
theme_minimal()
License
Data are available as CC-BY.
Citation
Please cite this package using:
citation("worldhdi")
#> To cite package 'worldhdi' in publications use:
#>
#> Dubey Y (2024). "worldhdi: Human Development Index Worldwide
#> 1990-2022." doi:10.5281/zenodo.14006110
#> <https://doi.org/10.5281/zenodo.14006110>.
#>
#> A BibTeX entry for LaTeX users is
#>
#> @Misc{dubey,
#> title = {worldhdi: Human Development Index Worldwide 1990-2022},
#> author = {Yash Dubey},
#> doi = {10.5281/zenodo.14006110},
#> abstract = {This package provides details about Human Development Index across the world from 1990 to 2022. 193 countries are included in the dataset. It also includes data aggregated by regions.},
#> year = {2024},
#> version = {0.1.0},
#> }