Storytelling with open data

Inflation trend in India by Sector from 2013 to 2024 using CPI

Nachiappan Nachiappan (s4036471)

2024-06-13

Objective

Inflation is the price rise in goods and services over a period of time. The period from 2013 to 2024 has been marked by significant economic challenges in India, particularly in terms of inflation and the cost of living. This open data storytelling explores the trends in inflation through the lens of the Consumer Price Index (CPI), which helps us to measure inflation for three key sectors: Rural, Urban, and combined (Rural+Urban). By leveraging data visualization techniques, I want to tell a compelling story that not only presents the data but also provides insights and context, making the information accessible and engaging to a broad audience.

Source: Government of India. (2024). All India consumer price index (Rural/Urban) up to February 2024. data.gov.in. Retrieved from https://data.gov.in/resource/all-india-consumer-price-index-ruralurban-upto-february-2024

#Packages 
library(ggplot2) 
library(dplyr)  
library(knitr) 
library(tidyverse)
library(plotly)
library(readr)
library(readxl)

Audience:

The audience for this data visualization primarily includes a diverse group of stakeholders who are interested in understanding the trends and implications of inflation and the cost of living in India over the past decade. The key audiences are Policymakers and Government Officials,Economists and Researchers,Business Leaders and Investors,Academia and Students,General Public and Media,Non-Governmental Organizations (NGOs) and Advocacy Groups.

# Load the dataset
data <- read_csv("All_India_Index_Upto_Feb24.csv")
colnames(data) <- c("Sector", "Year", "Month", "Cereals_and_products", "Meat_and_fish", "Egg",
  "Milk_and_products","Oils_and_fats", "Fruits", "Vegetables","Pulses_and_products", 
  "Sugar_and_Confectionery","Spices","Non-alcoholic_beverages", "Prepared_meals_snacks_sweets_etc", 
  "Food_and_beverages", "Pan_tobacco_intoxicants", "Clothing", "Footwear", "Clothing_and_footwear", 
  "Housing", "Fuel_and_light", "Household_goods_and_services", "Health","Transport_and_communication", 
  "Recreation_and_amusement", "Education","Personal_care_and_effects", "Miscellaneous", "General_index")
data$Housing <- as.numeric(data$Housing)
data$Sector <- as.factor(data$Sector)
data$Month <- as.factor(data$Month)
# Handle missing values by replacing them with mean of that column
cleaned_data <-data %>% mutate(across(where(is.numeric),~ifelse(is.na(.),mean(., na.rm = TRUE),.)))

Visualisation-1:Consumer Food Price Index (CFPI)

# Adding the food product columns so as to compute CFPI
cleaned_data <- cleaned_data %>%
  mutate(CFPI = rowSums(across(c(Cereals_and_products, Meat_and_fish, Egg, Milk_and_products, 
  Oils_and_fats, Fruits, Vegetables, Pulses_and_products, 
  Sugar_and_Confectionery, Spices)))/10)

# Interactive plot for Consumer Food Price Index (taking food products) grouped by Year and Sector
data_summary_food <- cleaned_data %>%  group_by(Year, Sector) %>%summarize(CFPI = mean(CFPI))
ggplotly(ggplot(data_summary_food, aes(x = Year, y = CFPI, color = Sector)) +
geom_line(size = 1) +  geom_point(size = 2) +
labs(title = "Consumer Food Price Index of India (CFPI) by Sector from 2013 to 2024",
     x = "Year",y = "Consumer Food Price Index",color = "Sector")+ theme_minimal() + 
     scale_x_continuous(breaks = 2013:2024))

Inference from CFPI

Visualisation-2:Consumer Price Index

# Interactive plot for Consumer Price Index (CPI) grouped by Year and Sector
data_summary_cpi <- cleaned_data %>%  group_by(Year, Sector) %>%
                    summarize(General_index = mean(General_index))
ggplotly(ggplot(data_summary_cpi, aes(x = Year, y = General_index, 
        color = Sector)) + geom_line(size = 1) +  geom_point(size = 2) +
        labs(title = "Consumer Price Index of India by Sector from 2013 to 2024",
        x = "Year", y = "Consumer Price Index",color = "Sector") +
        theme_minimal() + scale_x_continuous(breaks = 2013:2024))

Inference from CPI

Visualisation-3:Inflation Rate

# Load the Inflation dataset from World bank
inflation <- read_excel("Inflation.xlsx")

# Interactive plot for showing rate of Inflation (Rural+Urban) in India
ggplotly(ggplot(inflation, aes(x = Year, y = Inflation_rate)) +
geom_line(size = 1, color = "blue") +  geom_point(size = 2, color = "red") +
labs(title = "Inflation rate in India for Rural+ Urban from 2013 to 2023",x = "Year",
     y = "Rate of Inflation (%)")+ theme_minimal() + scale_x_continuous(breaks = 2013:2023))

Inference from rate of Inflation

Source: World Bank. (n.d.). Inflation, consumer prices (annual %) - India. Retrieved from https://data.worldbank.org/indicator/FP.CPI.TOTL.ZG?end=2022&locations=IN&start=2013

References:

1.Government of India. (2024). All India consumer price index (Rural/Urban) up to February 2024. data.gov.in. Retrieved from https://data.gov.in/resource/all-india-consumer-price-index-ruralurban-upto-february-2024

2.World Bank. (n.d.). Inflation, consumer prices (annual %) - India. Retrieved from https://data.worldbank.org/indicator/FP.CPI.TOTL.ZG?end=2022&locations=IN&start=2013

3.ggplot2: Wickham, H. (2016). ggplot2: Elegant graphics for data analysis. Springer-Verlag. Retrieved from https://ggplot2.tidyverse.org

4.plotly: Sievert, C. (2020). Interactive web-based data visualization with R, plotly, and shiny. Chapman and Hall/CRC. Retrieved from https://plotly-r.com

5.Macrotrends. (n.d.). India inflation rate 1960-2023. Retrieved from https://www.macrotrends.net/global-metrics/countries/IND/india/inflation-rate-cpi