library(readxl)
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(ggplot2)

1.DATA IMPORT

industry_data <- read_excel("public_use-industry-employment-growth.xlsx",
  sheet = "Growth from Industry Transition")

head(industry_data)
## # A tibble: 6 × 13
##   country_code country_name         wb_region       wb_income isic_section_index
##   <chr>        <chr>                <chr>           <chr>     <chr>             
## 1 ae           United Arab Emirates Middle East & … High inc… B                 
## 2 ae           United Arab Emirates Middle East & … High inc… B                 
## 3 ae           United Arab Emirates Middle East & … High inc… C                 
## 4 ae           United Arab Emirates Middle East & … High inc… C                 
## 5 ae           United Arab Emirates Middle East & … High inc… C                 
## 6 ae           United Arab Emirates Middle East & … High inc… C                 
## # ℹ 8 more variables: isic_section_name <chr>, industry_id <dbl>,
## #   industry_name <chr>, growth_rate_2015 <dbl>, growth_rate_2016 <dbl>,
## #   growth_rate_2017 <dbl>, growth_rate_2018 <dbl>, growth_rate_2019 <dbl>

2.This dataset contains 7,335 observations from multiple countries and industries.

data_summary <- summarize( industry_data,total_rows = n(),total_countries = n_distinct(country_name),total_industries = n_distinct(industry_name))

data_summary
## # A tibble: 1 × 3
##   total_rows total_countries total_industries
##        <int>           <int>            <int>
## 1       7335             128               77

3.The High income group has the largest number of observations, followed by Upper middle income, Lower middle income, and Low income.

income_count <- count( industry_data, wb_income,sort = TRUE)

income_count
## # A tibble: 4 × 2
##   wb_income               n
##   <chr>               <int>
## 1 High income          3348
## 2 Upper middle income  1996
## 3 Lower middle income  1537
## 4 Low income            454
income_grouped <- group_by( industry_data,wb_income)

income_growth <- summarize( income_grouped, average_growth_2019 = mean(growth_rate_2019))

income_growth
## # A tibble: 4 × 2
##   wb_income           average_growth_2019
##   <chr>                             <dbl>
## 1 High income                     0.00609
## 2 Low income                     -0.00236
## 3 Lower middle income            -0.00369
## 4 Upper middle income            -0.00562

4.INSIGHT#1 The results show that High income countries had the highest average employment growth in 2019 at about 0.61%. The other income groups had negative average employment growth. Low income countries averaged about -0.24%, Lower middle income countries averaged about -0.37%, and Upper middle income countries averaged about -0.56%.

income_growth$average_growth_percent <-  income_growth$average_growth_2019 * 100

income_growth
## # A tibble: 4 × 3
##   wb_income           average_growth_2019 average_growth_percent
##   <chr>                             <dbl>                  <dbl>
## 1 High income                     0.00609                  0.609
## 2 Low income                     -0.00236                 -0.236
## 3 Lower middle income            -0.00369                 -0.369
## 4 Upper middle income            -0.00562                 -0.562

5.INSIGHT#2 The industry with the highest average employment growth in 2019 was Venture Capital & Private Equity, with an average growth rate of approximately 3.20%.

Other industries with relatively strong growth included Animation, Computer & Network Security, Renewables & Environment, and Internet.

This suggests that several technology, investment, and emerging industries experienced relatively strong employment growth in 2019.

industry_grouped <- group_by( industry_data,industry_name)

industry_growth <- summarize(  industry_grouped,  average_growth_2019 = mean(growth_rate_2019),
  observations = n())

industry_growth$average_growth_percent <-  industry_growth$average_growth_2019 * 100
industry_growth <- arrange( industry_growth, desc(average_growth_2019))

head(industry_growth, 10)
## # A tibble: 10 × 4
##    industry_name         average_growth_2019 observations average_growth_percent
##    <chr>                               <dbl>        <int>                  <dbl>
##  1 Venture Capital & Pr…             0.0320            66                  3.20 
##  2 Animation                         0.0228            65                  2.28 
##  3 Computer & Network S…             0.0199            91                  1.99 
##  4 Renewables & Environ…             0.0149           111                  1.49 
##  5 Railroad Manufacture              0.0137            39                  1.37 
##  6 Internet                          0.0123           127                  1.23 
##  7 Investment Management             0.00959          113                  0.959
##  8 Aviation & Aerospace              0.00868           95                  0.868
##  9 Biotechnology                     0.00848           95                  0.848
## 10 Executive Office                  0.00749           76                  0.749
ggplot(
  income_growth,
  aes(
    x = wb_income,
    y = average_growth_percent
  )
) +
  geom_col() +
  labs(
    title = "Average Employment Growth by Income Group in 2019",
    x = "World Bank Income Group",
    y = "Average Employment Growth (%)"
  ) +
  theme_minimal()