R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

#importing required libraries 
library(readxl)
## Warning: package 'readxl' was built under R version 4.4.2
library(dplyr)
## Warning: package 'dplyr' was built under R version 4.4.2
## 
## 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)
## Warning: package 'ggplot2' was built under R version 4.4.2
#importing the penn world dataset
penn <- read_excel("C:/Users/Mitali Honkan/Downloads/pwt1001 (1).xlsx",sheet="Data")

#filtering the data to 5 countries 
pennfilter<-penn%>%
  filter(country==c("India","China","Germany","United States","Japan"))
head(pennfilter)
## # A tibble: 6 × 52
##   countrycode country currency_unit  year    rgdpe    rgdpo   pop   emp   avh
##   <chr>       <chr>   <chr>         <dbl>    <dbl>    <dbl> <dbl> <dbl> <dbl>
## 1 CHN         China   Yuan Renminbi  1951      NA       NA    NA    NA    NA 
## 2 CHN         China   Yuan Renminbi  1956  693936.  688503.  625.  265.   NA 
## 3 CHN         China   Yuan Renminbi  1961  557476   554674.  650.  286.   NA 
## 4 CHN         China   Yuan Renminbi  1966  873070.  867201.  742.  302.   NA 
## 5 CHN         China   Yuan Renminbi  1971 1185134. 1173451.  849.  376. 1976.
## 6 CHN         China   Yuan Renminbi  1976 1280488. 1272721.  943.  432. 1974.
## # ℹ 43 more variables: hc <dbl>, ccon <dbl>, cda <dbl>, cgdpe <dbl>,
## #   cgdpo <dbl>, cn <dbl>, ck <dbl>, ctfp <dbl>, cwtfp <dbl>, rgdpna <dbl>,
## #   rconna <dbl>, rdana <dbl>, rnna <dbl>, rkna <dbl>, rtfpna <dbl>,
## #   rwtfpna <dbl>, labsh <dbl>, irr <dbl>, delta <dbl>, xr <dbl>, pl_con <dbl>,
## #   pl_da <dbl>, pl_gdpo <dbl>, i_cig <chr>, i_xm <chr>, i_xr <chr>,
## #   i_outlier <chr>, i_irr <chr>, cor_exp <dbl>, statcap <dbl>, csh_c <dbl>,
## #   csh_i <dbl>, csh_g <dbl>, csh_x <dbl>, csh_m <dbl>, csh_r <dbl>, …
#GDP per capita of countries over time
# Here we have created another filtered dataset pennfilter1 for this visualisation 

pennfilter1 <- pennfilter %>%
  mutate(gdp_per_capita = rgdpe / pop)

# Line plot of GDP per capita over time for each country
ggplot(pennfilter1, aes(x = year, y = gdp_per_capita, color = country)) +
  geom_line() +
  labs(title = "GDP Per Capita Over Time",
       x = "Year",
       y = "GDP Per Capita (mil. 2017 USD)") +
  theme_minimal() +
  theme(legend.position = "bottom")
## Warning: Removed 1 row containing missing values or values outside the scale range
## (`geom_line()`).

# Load necessary libraries
library(dplyr)
library(ggplot2)

# Calculate Employment Percentage and Group by Year and Country
#Here we create another filtere dataset pennfilter2 fott this sepcific visualisation
pennfilter2 <- pennfilter %>%
  mutate(emp_percentage = (emp / pop) * 100) %>%
  group_by(country) %>%
  mutate(avg_emp_percentage = mean(emp_percentage, na.rm = TRUE))

# Create a Bar Plot for Average Employment Percentage by Country Over Years
ggplot(pennfilter2, aes(x = country, y = avg_emp_percentage, fill = country)) +
  geom_bar(stat = "identity", position = "dodge") +
  labs(title = "Average Employment Percentage Over Years by Country",
       x = "Year",
       y = "Average Employment Percentage (%)") +
  theme_minimal()

#GDP over time
ggplot(pennfilter, aes(x = year, y = rgdpe, color = country)) +
  geom_line() +
  labs(title = "Real GDP (Expenditure-side) Over Time",
       x = "Year",
       y = "Real GDP (mil. 2017 USD)",
       color = "Country") +
  theme_minimal() +
  theme(legend.position = "bottom")
## Warning: Removed 1 row containing missing values or values outside the scale range
## (`geom_line()`).

ggplot(data = pennfilter1, aes(x = avh, y = gdp_per_capita, color = country)) +
  geom_point(size = 3) +
  labs(
    title = "Hours Worked vs GDP per Capita",
    x = "Average Annual Hours Worked",
    y = "GDP per Capita (2017 US$)",
    color = "Country"
  ) +
  theme_minimal()
## Warning: Removed 8 rows containing missing values or values outside the scale range
## (`geom_point()`).

#Comparative Observations

    #United States and Germany: Both countries showcase high productivity and living standards, driven by innovation and efficient labor markets. The U.S. leads with its dynamic economy focused on technology and services, while Germany excels in engineering, green technology, and high-value exports. Both countries balance work-life demands, with lower working hours but high GDP per capita.

   # China: Rapidly closing the gap with developed nations, China’s transformation from an agrarian economy to a global industrial hub is unmatched. Its high GDP growth reflects its focus on manufacturing and export, with recent shifts towards innovation and service sectors. However, labor distribution remains uneven, with rural-urban disparities still evident.

   # Japan: Japan’s resilience stems from its advanced manufacturing and expertise in robotics, despite economic stagnation and demographic challenges. It has high GDP per capita and productivity per hour, but labor shortages due to an aging population highlight the need for reforms. Efforts to reduce overwork and encourage automation are critical for its future.

   # India: India has immense growth potential, fueled by its young population and expanding service sector. However, its lower GDP per capita reflects challenges like income inequality, a large informal workforce, and over-reliance on agriculture. Strategic investments in skill development and technology could help India replicate China’s rapid industrialization.

   # United States vs. Japan: Both countries lead in innovation, but the U.S. demonstrates more robust economic growth and adaptability. Japan’s economy is constrained by its demographic decline, while the U.S. benefits from a larger and more diverse workforce.

   # India vs. China: While both countries are populous and emerging economies, China’s industrial advancements and urbanization are significantly ahead. India has yet to fully capitalize on its demographic dividend, needing more reforms in infrastructure, education, and healthcare to match China’s growth trajectory.

Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.