Introduction

This dataset consists of trade values for export and import of commodities in million US$. It is tidy and each row consists of a single observation. Using India’s import and export data, we will determine the following insights:

1.How much revenue was generated from exports? 2.How much was spent on imports? and generated from exports? Was there a trade surplus or deficit? 3.Top 5 exported and imported commodities 4.Comparing exports against imports by year using percentages.

Loading libraries

Exploratory Data Analysis

The export data set has 137 023 observations and 5 variables. The import data set has 76 124 observations and 5 variables.

The import and export data sets have 11588 and 14038 NAs in the Value column respectively. To be able to work with the whole data set without removing crucial data, we have replaced all NA’s with 0.0.

The Commodity names are too long, therefore the HSCode has been used to identify the corresponding Commodity names for efficiency.

Import costs for the top 5 products

This plot visualizes how much was spent on imports between the years 2010 and 2018. The darker shades resemble the lowest amounts spent and the lighter shades represent higher values of money spent on imports.

Likewise, the top 5 products that were imported include Electrical machines, Mineral Fuels, Natural or cultural ornaments, Nuclear reactors and Organic Chemicals. The plot shows that Organic chemicals were the least imported with their highest import value occurring in 2018 at $22389.41. Mineral Fuels however, have the highest import values compared to all the other products. It’s highest cost was incurred in 2013 at $181 382.57.

ggplot(Products1,aes(Commodity,year))+
  geom_tile(aes(fill= sum_total),color = 'black')+
  geom_text(aes(label = sum_total), size = 5, fontface = 'bold', color = 'black') +
  labs(title = 'Table.1 Top five imports by value') +
  theme(panel.grid = element_blank())+
  scale_fill_gradient(low = 'green3', high = 'orange')+
  theme(
        axis.ticks = element_blank(), 
        axis.text.x = element_text(angle = 330, hjust = 0))+
  scale_x_discrete( expand = c(0, 0)) 

  #scale_y_discrete( expand = c(0, 0))

How much was spent on imports? How much was generated from exports? Was there a trade surplus or deficit?

The difference between export revenue and import costs results in a trade deficit if the country has spent more on imports than it has generated from exports. The opposite results in a trade surplus.

From the plot, India has had a trade deficit from 2010 to 2018 with more imports than exports. Its highest import value according to this plot is more than $500k and its highest export value is a little over $300k.

CT <- ggplot(yearly.imp.exp.m, aes(year, value, fill = variable)) 
CF <- CT + geom_bar(stat = "identity", position = "dodge") + 
  scale_y_continuous(labels = unit_format(unit = "K", scale = 1e-03, prefix = "$")) 

CF +
  theme_minimal()

Top 5 exported commodities in India

The top 5 commodities that were exported the most over the years 2010 and 2018 were Mineral Fuels,Natural or Cultured pearls, Organic chemicals, Vehicles and Nuclear reactors. Mineral fuels evidently brought in the most revenue compared to the other commodities over the years 2010 to 2014 and 2018. Its highest amount of revenue generated amounted to $64.7 billion in 2013. Organic chemicals however, had the lowest export revenues for most of the trades between 2010 and 2018.

g2 <- ggplot(df_2)+
  geom_point(aes(x=year,y=value_n_billion,color=Commodity_HSCode),size = 1, alpha = 0.8)+
  geom_line(aes(x=year,y=value_n_billion,color=Commodity_HSCode))+
  labs(title ="TOP 5 EXPORT COMMODITIES", x = "", y="Export in billions")+
  theme(panel.border = element_rect(colour = "black", fill=NA, size=1))+
  theme_classic()
  

ggplotly(g2) %>% hide_legend()

We can also visualize India’s top exports by value using a treemap. In this case, the lighter the shade/colour, the higher the export value of the product. The lighter the color/shade, the lower the export value of the product. This plot also shows Mineral Fuels to have had the highest export revenues.

Top 5 Imported commodities in India

The top 5 commodities that were imported the most over the years 2010 and 2018 were Mineral Fuels, Natural or Cultured pearls, Organic chemicals, Vehicles and Nuclear reactors. India spent the most on Mineral fuels throughout the trading period from 2010 to 2018; and spent the least on Vehicle imports during the same period.

g3 <- ggplot(df_3)+
  geom_point(aes(x=year,y=value_n_billion,color=Commodity_HSCode),size = 1, alpha = 0.8)+
  geom_line(aes(x=year,y=value_n_billion,color=Commodity_HSCode))+
  labs(title ="TOP 5 IMPORT COMMODITIES",x = "", y="Import in billions")+
  theme(panel.border = element_rect(colour = "black", fill=NA, size=1))+
  theme_classic()
  

ggplotly(g3) %>% hide_legend()

Comparing exports against imports by year using percentages.

This plot compares India’s exports to imports based on percentages. At a glance, one is able to deduce that India has spent more on imports than they have generated from exports over the period 2010- 2018.

ggplotly(d)

Conclusion

Economies generally thrive to increase their exports and decrease imports inorder to boost their overal GDP. India, however has had a trade deficit over the period of 2010 to 2018, with more imports than exports which overally does not contribute positively to the country’s GDP.