Prompt: [insert only the number of the prompt you chose to answer for this assignment; do not copy/paste the text of the prompt here]

ChatGPT/AI disclosure statement: [describe whether and how you used ChatGPT or other AI tools for this assignment. If you did not, please write “I did not use ChatGPT or other AI for this assignment.”]

1.Introduction

Gender inequality continues to challenge global economic development. This report analyzes World Bank Gender Portal data across key indicators: female labor force participation (women aged 15+), labor force with basic education, female-to-male participation ratios, female-headed households, and women’s share in senior management roles.These indicators reveal stark global disparities and volatility over time, reflecting changes in social and economic conditions. While some regions have made measurable progress, others continue to face persistent gaps in women’s participation and representation. Clear insights from this data offer valuable guidance for addressing inequality and promoting inclusive growth

2.Retrieving primary data through APIs

This analysis draws upon primary data obtained through the World Bank’s Gender Portal API. The API calls were made using the httr package in R, facilitating GET requests to retrieve JSON-formatted data. The base URL specified multiple indicators of interest across all countries, spanning categories such as total labor force participation, gender-specific data, and employment in senior management roles. Parameters were appended to control the data format and paging requirements, ensuring comprehensive data extraction. A custom function, combined with lapply(), was employed to iterate over each page and retrieve the necessary data. The lapply() function allowed for applying to fetch the data function to each page in the dataset, returning the results as a list. This list was then combined into a single data frame using bind_rows() from the dplyr package.The jsonlite package’s fromJSON() function was employed to parse the JSON response into structured data frames. To enhance usability, the data was subjected to a cleaning process using the janitor package, which standardized column names by removing special characters and spaces. This systematic approach ensures reliable and reproducible data collection, enabling meaningful insights into global gender-based labor disparities and trends over time.

library(httr)
library(jsonlite)
library(dplyr)
library(janitor)
library(rnaturalearth)
library(sf)
library(dplyr)
library(classInt)
library(ggplot2)
library(viridis)
library(tidyverse)
library(kableExtra)
library(ggthemes)
#Female Labor Force(% of female above15 years of age) data


# Base URL and parameters for World Bank API
base_url_flfpr <- "https://api.worldbank.org/v2/country/all/indicator/SL.TLF.CACT.FE.ZS;SL.TLF.CACT.FE.NE.ZS;SL.TLF.CACT.MA.ZS;SL.TLF.CACT.MA.NE.ZS;SL.TLF.CACT.ZS;SL.TLF.CACT.NE.ZS;SL.TLF.ACTI.1524.FE.ZS;SL.TLF.ACTI.1524.FE.NE.ZS;SL.TLF.ACTI.1524.MA.ZS;SL.TLF.ACTI.1524.MA.NE.ZS;SL.TLF.ACTI.1524.ZS;SL.TLF.ACTI.1524.NE.ZS;SL.TLF.ACTI.FE.ZS;SL.TLF.ACTI.MA.ZS;SL.TLF.ACTI.ZS?source=14"
params_flfpr <- "&format=json&per_page=10000"

# Fetch the first page to determine total pages
first_page_flfpr  <- fromJSON(content(GET(paste0(base_url_flfpr, params_flfpr, "&page=1")), "text"))
total_pages_flfpr  <- first_page_flfpr[[1]]$pages

# Function to fetch and clean data
fetch_data_flfpr  <- function(page_flfpr ) {
  url_flfpr<- paste0(base_url_flfpr, params_flfpr, "&page=", page_flfpr)
  data_flfpr <- fromJSON(content(GET(url_flfpr ), "text"))[[2]]
  return(data_flfpr )
}

# Fetch all data and remove NA values from 'value' column
all_data_flfpr <- bind_rows(lapply(1:total_pages_flfpr , fetch_data_flfpr )) %>%
  filter(!is.na(value))  # Remove rows with NA in value column

# Clean column names by removing special characters and standardizing
cleaned_data_flfpr  <- all_data_flfpr  %>% 
  clean_names()  # janitor removes spaces, special characters, and ensures lowercase

flatten_data_flfpr  <- all_data_flfpr  %>%
  mutate(indicator_id = indicator$id,
         indicator_value = indicator$value,
         country_id = country$id,
         country_name = country$value) %>%
  select(-indicator, -country) %>%
  select(country_id, country_name, countryiso3code, date, value, unit, obs_status, decimal, indicator_id, indicator_value) %>%
  clean_names()  # Standardize column names using janitor 

##Female Labor force with basic education(%) data

# Base URL and parameters for World Bank API
base_url <- "https://api.worldbank.org/v2/country/all/indicator/SL.TLF.BASC.FE.ZS?source=14"
params <- "&format=json&per_page=10000"

# Getting the numbers of pages that contains the data
first_page <- fromJSON(content(GET(paste0(base_url, params, "&page=1")), "text"))

total_pages <- first_page[[1]]$pages

# Function for fetching each page data
fetch_data <- function(page) {
  url <- paste0(base_url, params, "&page=", page)
  fromJSON(content(GET(url), "text"))[[2]]
}

# Using lapply function to combine data from all the pages
all_data <- bind_rows(lapply(1:total_pages, fetch_data))



# Unnesting the columns from the original data
flatten_data <- all_data %>%
  mutate(indicator_id = indicator$id,
    indicator_value = indicator$value,
    country_id = country$id,
    country_name = country$value) %>%
  select(-indicator, -country) %>%
  select(country_id, country_name, countryiso3code, date, value, unit, obs_status, decimal, indicator_id, indicator_value) %>%
  clean_names()  # Standardize column names using janitor 

##Ratio of female to male labor force participation rate (%) data
# Base URL and parameters for World Bank API
base_url_lfpr_ratio <- "https://api.worldbank.org/v2/country/all/indicator/SL.TLF.CACT.FM.ZS;SL.TLF.CACT.FM.NE.ZS?source=14"
params_lfpr_ratio <- "&format=json&per_page=10000"

# Fetch the first page to determine total pages
first_page_lfpr_ratio  <- fromJSON(content(GET(paste0(base_url_lfpr_ratio, params_lfpr_ratio, "&page=1")), "text"))
total_pages_lfpr_ratio  <- first_page_lfpr_ratio[[1]]$pages

# Function to fetch and clean data
fetch_data_lfpr_ratio  <- function(page_lfpr_ratio ) {
  url_lfpr_ratio<- paste0(base_url_lfpr_ratio, params_lfpr_ratio, "&page=", page_lfpr_ratio)
  data_lfpr_ratio <- fromJSON(content(GET(url_lfpr_ratio ), "text"))[[2]]
  return(data_lfpr_ratio )
}

# Fetch all data and remove NA values from 'value' column
all_data_lfpr_ratio <- bind_rows(lapply(1:total_pages_lfpr_ratio , fetch_data_lfpr_ratio )) %>%
  filter(!is.na(value))  # Remove rows with NA in value column

# Clean column names by removing special characters and standardizing
cleaned_data_lfpr_ratio  <- all_data_lfpr_ratio  %>% 
  clean_names()  # janitor removes spaces, special characters, and ensures lowercase

flatten_data_lfpr_ratio  <- all_data_lfpr_ratio  %>%
  mutate(indicator_id = indicator$id,
         indicator_value = indicator$value,
         country_id = country$id,
         country_name = country$value) %>%
  select(-indicator, -country) %>%
  select(country_id, country_name, countryiso3code, date, value, unit, obs_status, decimal, indicator_id, indicator_value) %>%
  clean_names()  # Standardize column names using janitor 

##Data on unpaid work
base_url_unpaid <- "https://api.worldbank.org/v2/country/all/indicator/SG.TIM.UWRK.FE;SG.TIM.UWRK.MA?source=14"
params_unpaid <- "&format=json&per_page=10000"

# Fetch the first page to determine total pages
first_page_unpaid  <- fromJSON(content(GET(paste0(base_url_unpaid, params_unpaid, "&page=1")), "text"))
total_pages_unpaid  <- first_page_unpaid[[1]]$pages

# Function to fetch and clean data
fetch_data_unpaid  <- function(page_unpaid ) {
  url_unpaid<- paste0(base_url_unpaid, params_unpaid, "&page=", page_unpaid)
  data_unpaid <- fromJSON(content(GET(url_unpaid ), "text"))[[2]]
  return(data_unpaid )
}

# Fetch all data and remove NA values from 'value' column
all_data_unpaid <- bind_rows(lapply(1:total_pages_unpaid , fetch_data_unpaid )) %>%
  filter(!is.na(value))  # Remove rows with NA in value column

# Clean column names by removing special characters and standardizing
cleaned_data_unpaid  <- all_data_unpaid  %>% 
  clean_names()  # janitor removes spaces, special characters, and ensures lowercase

flatten_data_unpaid  <- all_data_unpaid  %>%
  mutate(indicator_id = indicator$id,
         indicator_value = indicator$value,
         country_id = country$id,
         country_name = country$value) %>%
  select(-indicator, -country) %>%
  select(country_id, country_name, countryiso3code, date, value, unit, obs_status, decimal, indicator_id, indicator_value) %>%
  clean_names()  # Standardize column names using janitor 

3.Retrieving the secondary data

This report examines two key indicators: the percentage of households with a female head and the female share of employment in senior and middle management. The first highlights women’s economic independence, while the second reveals gender disparities in leadership roles.Together, these indicators underscore the dual challenges women face: greater responsibility in households alongside limited representation in top professional positions. This contrast emphasizes the ongoing barriers to gender equality in both the domestic and corporate spheres.

#Percentage of the households having female head data

# Base URL and parameters for World Bank API
base_url_female_head <- "https://api.worldbank.org/v2/country/all/indicator/SP.HOU.FEMA.ZS?source=14"
params_female_head <- "&format=json&per_page=10000"

# Fetch the first page to determine total pages
first_page_female_head  <- fromJSON(content(GET(paste0(base_url_female_head, params_female_head, "&page=1")), "text"))
total_pages_female_head  <- first_page_female_head[[1]]$pages

# Function to fetch and clean data
fetch_data_female_head  <- function(page_female_head ) {
  url_female_head<- paste0(base_url_female_head, params_female_head, "&page=", page_female_head)
  data_female_head <- fromJSON(content(GET(url_female_head ), "text"))[[2]]
  return(data_female_head )
}

# Fetch all data and remove NA values from 'value' column
all_data_female_head <- bind_rows(lapply(1:total_pages_female_head , fetch_data_female_head )) %>%
  filter(!is.na(value))  # Remove rows with NA in value column

# Clean column names by removing special characters and standardizing
cleaned_data_female_head  <- all_data_female_head  %>% 
  clean_names()  # janitor removes spaces, special characters, and ensures lowercase

flatten_data_female_head  <- all_data_female_head  %>%
  mutate(indicator_id = indicator$id,
         indicator_value = indicator$value,
         country_id = country$id,
         country_name = country$value) %>%
  select(-indicator, -country) %>%
  select(country_id, country_name, countryiso3code, date, value, unit, obs_status, decimal, indicator_id, indicator_value) %>%
  clean_names()  # Standardize column names using janitor 

#Female share of employment in senior and middle management (%)  data
# Base URL and parameters for World Bank API
base_url_position_tmd <- "https://api.worldbank.org/v2/country/all/indicator/SL.EMP.SMGT.FE.ZS?source=14"
params_position_tmd <- "&format=json&per_page=10000"

# Fetch the first page to determine total pages
first_page_position_tmd  <- fromJSON(content(GET(paste0(base_url_position_tmd, params_position_tmd, "&page=1")), "text"))
total_pages_position_tmd  <- first_page_position_tmd[[1]]$pages

# Function to fetch and clean data
fetch_data_position_tmd  <- function(page_position_tmd ) {
  url_position_tmd<- paste0(base_url_position_tmd, params_position_tmd, "&page=", page_position_tmd)
  data_position_tmd <- fromJSON(content(GET(url_position_tmd ), "text"))[[2]]
  return(data_position_tmd )
}

# Fetch all data and remove NA values from 'value' column
all_data_position_tmd <- bind_rows(lapply(1:total_pages_position_tmd , fetch_data_position_tmd )) %>%
  filter(!is.na(value))  # Remove rows with NA in value column

# Clean column names by removing special characters and standardizing
cleaned_data_position_tmd  <- all_data_position_tmd  %>% 
  clean_names()  # janitor removes spaces, special characters, and ensures lowercase

4. Tabular data and transformations

  1. Rank Assignment for Female Labor Force Participation (dense_rank function)
  2. Top and Bottom 20 Female Labor Force Participation
  3. Calculation of Difference Between Female and Male Participation
  4. Pivot Wider for Country-Based Gender Participation
  5. Quintile Classification of Data (Calculation of quantiles using cut and breaks method)
##Calculations for the first primary part##
flatten_data_flfpr  <- all_data_flfpr  %>%
  mutate(indicator_id = indicator$id,
         indicator_value = indicator$value,
         country_id = country$id,
         country_name = country$value) %>%
  select(-indicator, -country) %>%
  select(country_id, country_name, countryiso3code, date, value, unit, obs_status, decimal, indicator_id, indicator_value) %>%
  clean_names()  # Standardize column names using janitor 



map_flfpr<-flatten_data_flfpr%>%ungroup()%>%group_by(country_name)%>%
mutate(date=as.numeric(date))%>%filter(date==max(date))%>%ungroup()


map_flfpr<-map_flfpr%>%mutate(indicator_id = case_when(
    indicator_id == "SL.TLF.CACT.FE.ZS" ~ "Female",
    indicator_id=="SL.TLF.CACT.MA.ZS"~ "Male",
    TRUE~indicator_id))%>%filter(indicator_id%in%c("Male","Female"))

map_flfpr<-map_flfpr%>%select(country_name,value,indicator_id)

map_flfpr<-map_flfpr%>%pivot_wider(names_from =indicator_id,values_from = value)%>%
  mutate(across(where(is.numeric), ~ round(.x, 2)))


time_series<-flatten_data_flfpr%>%filter(country_name%in%c("United Kingdom",
    "United States","China","India"))%>%filter(date%in%c(1990:2020))


map_flfpr<-map_flfpr%>%mutate(Rank=dense_rank(desc(Female))) ##Rank assignment

top_20 <- map_flfpr%>% 
  arrange(desc(Female)) %>%
  slice_head(n = 20)%>%mutate(Cat="Top 20")

bottom_20 <- map_flfpr %>% 
  arrange(Female) %>%
  slice_head(n = 20)%>%mutate(Cat="Bottom 20")

# Merge the top 20 and bottom 20
merged_data <- bind_rows(top_20, bottom_20)  ##Top 20 and bottom 20 countries

merged_data<-merged_data%>%select(country_name,Female,Cat,Rank)


difference<-map_flfpr%>%mutate(Difference=Female-Male)

difference<-difference%>%select(country_name,Difference)%>%
  mutate(Rank=dense_rank(desc(Difference)))

mean_value <- mean(difference$Difference)
median_value <- median(difference$Difference)

##Basic education data stats-
flatten_data <- all_data %>%
  mutate(indicator_id = indicator$id,
    indicator_value = indicator$value,
    country_id = country$id,
    country_name = country$value) %>%
  select(-indicator, -country) %>%
  select(country_id, country_name, countryiso3code, date, value, unit, obs_status, decimal, indicator_id, indicator_value) %>%
  clean_names()  # Standardize column names using janitor 


country<-flatten_data%>%drop_na(value)

country<-country%>%filter(country_name%in%c("United Kingdom",
"United States","India","Central Europe and the Baltics",
"Africa Western and Central","Europe & Central Asia",
"European Union","High income","Latin America & Caribbean","Lower middle income","North America","OECD members","South Asia",
"Bangladesh","Pakistan","Afghanistan","Macao SAR, China",
"Russian Federation"))

country<-country%>%select(country_name, date, value)


country<-country%>%group_by(country_name,date)%>%mutate(date=as.numeric(date))


country<-country%>%filter(country_name%in%c("India","United Kingdom","United States","High Income","European Union","South Asia"))

##Male female ratio data

flatten_data_lfpr_ratio  <- all_data_lfpr_ratio  %>%
  mutate(indicator_id = indicator$id,
         indicator_value = indicator$value,
         country_id = country$id,
         country_name = country$value) %>%
  select(-indicator, -country) %>%
  select(country_id, country_name, countryiso3code, date, value, unit, obs_status, decimal, indicator_id, indicator_value) %>%
  clean_names()  # Standardize column names using janitor 


country_lfpr_ratio <-flatten_data_lfpr_ratio %>%drop_na(value)

country_lfpr_ratio <-country_lfpr_ratio%>%filter(country_name%in%c("United Kingdom",
"United States","India","Central Europe and the Baltics",
"Africa Western and Central","Europe & Central Asia",
"European Union","High income","Latin America & Caribbean","Lower middle income","North America","OECD members","South Asia","Bangladesh","Pakistan","Afghanistan","Macao SAR, China","Russian Federation"))

country_lfpr_ratio<-country_lfpr_ratio%>%select(country_name, date, value)


country_lfpr_ratio<-country_lfpr_ratio%>%group_by(country_name,date)%>%mutate(date=as.numeric(date))


country_lfpr_ratio<-country_lfpr_ratio%>%filter(country_name%in%c("India","United Kingdom","United States","High Income","European Union","South Asia"))

##Female household stats

flatten_data_female_head  <- all_data_female_head  %>%
  mutate(indicator_id = indicator$id,
         indicator_value = indicator$value,
         country_id = country$id,
         country_name = country$value) %>%
  select(-indicator, -country) %>%
  select(country_id, country_name, countryiso3code, date, value, unit, obs_status, decimal, indicator_id, indicator_value) %>%
  clean_names()  # Standardize column names using janitor 


country_female_head <-flatten_data_female_head%>%drop_na(value)%>%
  mutate(date=as.numeric(date))

country_female_head<-country_female_head%>%group_by(country_name)%>%
  filter(date==max(date))

country_female_head<-country_female_head%>%ungroup()%>%
  mutate(Rank=dense_rank(desc(value)))

top_bottom_five <- country_female_head%>%
  arrange(desc(value)) %>%  
  slice_head(n = 5) %>%  # Select top 5
  bind_rows(country_female_head %>%
      arrange(value) %>%  
      slice_head(n = 5))   # Select bottom 5

top_bottom_five<-top_bottom_five%>%select(country_name,value,Rank)


##Unpaid data stats
country_unpaid <-flatten_data_unpaid %>%drop_na(value)

country_unpaid <-country_unpaid%>%filter(country_name%in%c("United Kingdom",
    "United States","France","China",
  "Germany","Japan","Brazil","Canada","Italy"))

country_unpaid <- country_unpaid %>%
  select(country_name, indicator_id, date, value) %>%
  mutate(date = as.numeric(date)) %>%
  group_by(country_name) %>%
  filter(date == max(date)) %>%
  select(-date) %>%
  mutate(indicator_id = case_when(
    indicator_id == "SG.TIM.UWRK.FE" ~ "Female",
    TRUE ~ "Male"))


country_unpaid<-country_unpaid%>%pivot_wider(names_from = indicator_id,values_from = value)

#Female share of employment in senior and middle management
flatten_data_position_tmd  <- all_data_position_tmd  %>%
  mutate(indicator_id = indicator$id,
         indicator_value = indicator$value,
         country_id = country$id,
         country_name = country$value) %>%
  select(-indicator, -country) %>%
  select(country_id, country_name, countryiso3code, date, value, unit, obs_status, decimal, indicator_id, indicator_value) %>%
  clean_names()  # Standardize column names using janitor 


country_position_tmd <-flatten_data_position_tmd %>%drop_na(value)

country_position_tmd <-country_position_tmd%>%filter(country_name%in%c("United Kingdom",
    "United States","France","China",
  "Germany","Japan","Brazil","Canada","Italy","India"))

country_position_tmd<-country_position_tmd%>%select(country_name, date, value)


country_position_tmd<-country_position_tmd%>%group_by(country_name,date)%>%mutate(date=as.numeric(date))



quintile_tmd<-flatten_data_position_tmd%>%ungroup()%>%group_by(country_name)%>%
  mutate(date=as.numeric(date))%>%filter(date==max(date))

quintile_tmd <- quintile_tmd %>%
  select(country_name, value) %>%ungroup()%>%
  mutate(Quantile = cut(value,breaks = unique(quantile(value, probs = seq(0, 1, by = 0.2))),labels = c("Bottom 20", "20-40", "40-60", "60-80", "Top 20"),
      include.lowest = TRUE))

quintile_tmd<-quintile_tmd%>%group_by(Quantile)%>%summarise(`Median share`=median(value))

5.Findings:Graphs and Tables

Female labor force distribution across the countries show huge divergence and the distribution of the difference of female and male labor force participation remain highly skewed.The mean of the female labor force with basic education is just 37.9% and a high difference exists across the countries. The share of the women in the higher and mid label employment remains as low as ever and yet to recover the post pandemic value in some of the countries.

merged_data %>%
  kable("html", caption = "Female Labor Force Participation Rate", 
        col.names = c("Country", "Female (%)", "Category", "Rank")) %>%
  kable_styling("striped", full_width = FALSE) %>%
  add_header_above(c(" " = 1, "Huge difference between top 1 and bottom most country" = 3)) %>%
  footnote(general = "Data source: World Bank", 
           general_title = "Twenty countries with highest and lowest female Labor Force Participation Rate (%)")
Female Labor Force Participation Rate
Huge difference between top 1 and bottom most country
Country Female (%) Category Rank
Solomon Islands 82.73 Top 20 1
Madagascar 82.58 Top 20 2
Burundi 78.78 Top 20 3
Mozambique 78.42 Top 20 4
Tanzania 77.14 Top 20 5
Ethiopia 74.75 Top 20 6
Angola 72.76 Top 20 7
Liberia 72.42 Top 20 8
Kenya 72.20 Top 20 9
Moldova 72.17 Top 20 10
Eritrea 71.37 Top 20 11
South Sudan 70.33 Top 20 12
Iceland 70.07 Top 20 13
Korea, Dem. People’s Rep.  69.65 Top 20 14
Cambodia 69.46 Top 20 15
Viet Nam 68.48 Top 20 16
Uganda 67.59 Top 20 17
New Zealand 67.57 Top 20 18
Azerbaijan 67.40 Top 20 19
Cameroon 67.29 Top 20 20
Afghanistan 4.83 Bottom 20 224
Yemen, Rep.  5.10 Bottom 20 223
Iraq 11.38 Bottom 20 222
Jordan 14.05 Bottom 20 221
Syrian Arab Republic 14.14 Bottom 20 220
Iran, Islamic Rep.  14.38 Bottom 20 219
Middle East & North Africa (excluding high income) 15.60 Bottom 20 218
Middle East & North Africa (IDA & IBRD) 15.60 Bottom 20 218
Egypt, Arab Rep.  16.45 Bottom 20 217
Algeria 16.81 Bottom 20 216
Djibouti 18.53 Bottom 20 215
West Bank and Gaza 18.89 Bottom 20 214
Middle East & North Africa 18.94 Bottom 20 213
Morocco 19.81 Bottom 20 212
Arab World 19.98 Bottom 20 211
Somalia 21.15 Bottom 20 210
Pakistan 24.46 Bottom 20 209
Mauritania 26.41 Bottom 20 208
Tunisia 26.85 Bottom 20 207
Lebanon 27.48 Bottom 20 206
Twenty countries with highest and lowest female Labor Force Participation Rate (%)
Data source: World Bank
ggplot(difference, aes(x = Difference)) +
  geom_density(fill = "lightblue", alpha = 0.5) +  # Density plot with fill
  geom_vline(aes(xintercept = mean_value), color = "red", linetype = "dashed", size = 1) +  # Mean line
  geom_vline(aes(xintercept = median_value), color = "blue", linetype = "dotted", size = 1) +  # Median line
  annotate("text", x = mean_value, y = 0.02, label = paste("Mean =", round(mean_value, 2)), color = "red", angle = 90, vjust = -0.5) +  # Mean annotation
  annotate("text", x = median_value, y = 0.02, label = paste("Median =", round(median_value, 2)), color = "blue", angle = 90, vjust = 1.5) +  # Median annotation
  labs(title = "Density distribution of the difference of Female and Male LFPR",
       subtitle = "Difference is in percentage points",
       x = "Value",
       y = "Density",
       caption = "Data Source:World Bank") +
  theme_stata()

ggplot(country) +
  geom_line(aes(x =date, y = value,color = country_name), linewidth=1) +
  theme_wsj() +
  labs(title = "Labor Force Education by Country", 
       subtitle = "Comparison of labor force with basic education over time (%)",
       x = "Date", 
       y = "Value", 
       caption = "Data source: World Bank",
       color="Country/Regions:")+
   scale_y_continuous(limits = c(0, 90), breaks = seq(0, 80, by = 10)) +  
  scale_x_continuous(breaks = seq(0, max(country$date), by = 2))

ggplot(country_lfpr_ratio) +
  geom_line(aes(x =date, y = value, color = country_name), linewidth=1) +
  theme_wsj() +
  labs(title = "Ratio of female to male labor force participation rate (%)", 
       subtitle = "Ratio remains volatile for the India and South Asia region as overall",
       x = "Date", 
       y = "Value", 
       caption = "Data source: World Bank",
       color="Country/Regions:")+
    scale_y_continuous(limits = c(0, 90), breaks = seq(0, 90, by = 10)) + 
  scale_x_continuous(breaks = seq(0, max(country_lfpr_ratio$date), by = 2))

top_bottom_five %>%
  kable("html", caption = "Percentage of the households with a female household", 
        col.names = c("Country", "Female (%)", "Rank")) %>%
  kable_styling("striped", full_width = F) %>%
  add_header_above(c(" " = 1, "Huge gap across the countries for which the latest data is available" = 2)) %>%
  footnote(general = "Data source: World Bank", 
           general_title = "Time series data is not available on a regular basis for a number of countries")
Percentage of the households with a female household
Huge gap across the countries for which the latest data is available
Country Female (%) Rank
Ukraine 49.4 1
Eswatini 47.9 2
Eritrea 46.7 3
Haiti 45.1 4
Maldives 44.3 5
Afghanistan 1.7 67
Yemen, Rep.  7.8 66
Mali 8.2 65
Jordan 12.2 64
Pakistan 12.5 63
Time series data is not available on a regular basis for a number of countries
Data source: World Bank
country_unpaid %>%mutate(across(where(is.numeric), ~ round(.x, 2)))%>%
  kable("html", caption = "Proportion of time spend on the domestic and unpaid work(%)", 
        col.names = c("Country", "Female", "Male")) %>%
  kable_styling("striped", full_width = F) %>%
  add_header_above(c(" " = 1, "Data is for for the ten largest economies in the world" = 2)) %>%
  footnote(general = "Data source: World Bank", 
           general_title = "Data is not available for India")
Proportion of time spend on the domestic and unpaid work(%)
Data is for for the ten largest economies in the world
Country Female Male
Brazil 11.61 5.13
Canada 14.17 10.00
China 15.35 5.90
France 15.77 9.49
Germany 16.44 10.38
Italy 19.96 7.50
Japan 14.71 3.75
United Kingdom 16.01 12.25
United States 15.08 10.08
Data is not available for India
Data source: World Bank
ggplot(country_position_tmd) +
  geom_line(aes(x =date, y = value, color = country_name), linewidth=1) +
  theme_economist() +
  labs(title = "Percentage of women in middle and top and middle employment", 
       subtitle = "Time series of data for china is not available",
       x = "Date", 
       y = "Value", 
       caption = "Data source: World Bank",
       color="Country/Regions:")+
    scale_y_continuous(limits = c(0, 60), breaks = seq(0, 60, by = 10)) + 
  scale_x_continuous(breaks = seq(0, max(country_position_tmd$date), by = 2))

ggplot(quintile_tmd, aes(x = Quantile, y = `Median share`)) + 
  geom_bar(stat = "identity", fill = "steelblue") +
  geom_text(aes(label = round(`Median share`, 1)), 
            position = position_dodge(width = 0.9), 
            vjust = -0.5, size = 3) + 
  coord_flip() +
  theme_economist_white() +
  labs(title = "Quintile-wise share of women in middle and top and middle employment", 
       subtitle = "Twenty seven percentage points difference between top 20 and bottom 20 quintiles",
       x = "Quantile", 
       y = "Median Share (%)", 
       caption = "Data source: World Bank") +
  scale_y_continuous(limits = c(0, 90), breaks = seq(0, 90, by = 10))

6.Data and output storage