```{r setup, include=FALSE}

knitr::opts_chunk$set(echo = TRUE)

library(tidyverse)

library(plotly)

library(scales)

```

## Introduction

India has experienced rapid growth in digital payments and e-commerce over the last decade. The expansion of internet connectivity, smartphone adoption, UPI and government initiatives promoting cashless transactions have transformed consumer behaviours and retail business performance.

This report analyzes trends in digital payments, internet usage, and e-commerce growth using publicly available datasets from NPCI, World Bank, RBI, and Our World in Data.

##Import Data

```{r}

payments <- read_csv("digital_payments.csv")

ecommerce <- read_csv("ecommerce_market.csv")

internet <- read_csv("internet_users_india.csv")

```

##Figure 1 Growth of Digital Payment Transactions

```

{r fig1, fig.cap="Digital payment transactions have increased significantly in India."}

ggplot(payments,

aes(x = Year,

y = Digital_Payment_Volume)) +

geom_line(size=1.2,

color="blue") +

geom_point(size=3) +

labs(

title="Growth of Digital Payment Transactions in India",

x="Year",

y="Transaction Volume (Billions)"

)

```

| Year | Digital_Payment_Volume | UPI_Volume |

| ---- | ---------------------- | ---------- |

| 2018 | 18 | 5 |

| 2019 | 24 | 9 |

| 2020 | 34 | 22 |

| 2021 | 52 | 39 |

| 2022 | 78 | 61 |

| 2023 | 110 | 89 |

| 2024 | 145 | 120 |

##Figure2 UPI Growth Trend

```

{r fig2, fig.cap="UPI has emerged as the dominant digital payment platform in India."}

ggplot(payments,

aes(x=Year,

y=UPI_Volume)) +

geom_line(size=1.2,

color="darkgreen") +

geom_point(size=3) +

labs(

title="Growth of UPI Transactions",

x="Year",

y="UPI Transaction Volume (Billions)"

)

```

##Figure3 Internet Penetration

```

{r fig3, fig.cap="Internet penetration has steadily increased across India."}

ggplot(internet,

aes(x=Year,

y=Internet_Users_Percent)) +

geom_col(fill="steelblue") +

labs(

title="Internet Users in India",

x="Year",

y="Percentage of Population"

)

```

| Year | Internet_Users_Percent |

| ---- | ---------------------- |

| 2018 | 34 |

| 2019 | 41 |

| 2020 | 45 |

| 2021 | 49 |

| 2022 | 54 |

| 2023 | 60 |

| 2024 | 66 |

##Figure4 E-Commerce Market Size

```

{r fig4, fig.cap="India's e-commerce market has expanded rapidly."}

ggplot(ecommerce,

aes(x=Year,

y=Market_Size_USD_Billion)) +

geom_area(fill="orange",

alpha=.7) +

labs(

title="Growth of E-Commerce Market Size",

x="Year",

y="USD Billion"

)

```

| Year | Market_Size_USD_Billion |

| ---- | ----------------------- |

| 2018 | 38 |

| 2019 | 46 |

| 2020 | 64 |

| 2021 | 74 |

| 2022 | 88 |

| 2023 | 102 |

| 2024 | 118 |

##Figure5 Internet Vs Digital Payments

```

{r fig5, fig.cap="Higher internet penetration is associated with increased digital payment adoption."}

merged <- left_join(payments,

internet,

by="Year")

ggplot(merged,

aes(x=Internet_Users_Percent,

y=Digital_Payment_Volume)) +

geom_point(size=4,

color="red") +

geom_smooth(method="lm",

se=FALSE) +

labs(

title="Internet Usage and Digital Payment Adoption",

x="Internet Users (%)",

y="Digital Payment Volume"

)

```

##Figure6 Payment Method Comparison

```

{r fig6, fig.cap="UPI accounts for the majority of digital payment transactions."}

method_data <- tibble(

Method=c("UPI","IMPS","NEFT","RTGS","Cards"),

Volume=c(132,8,10,3,5)

)

ggplot(method_data,

aes(x=reorder(Method,Volume),

y=Volume,

fill=Method)) +

geom_col() +

coord_flip() +

labs(

title="Comparison of Digital Payment Methods",

x="Payment Method",

y="Transaction Volume"

)

```

##Figure7 Boxplot Transaction Distribution

```

{r fig7, fig.cap="Distribution of transaction volumes across payment methods."}

ggplot(method_data,

aes(x=Method,

y=Volume,

fill=Method)) +

geom_boxplot() +

labs(

title="Distribution of Digital Payment Volumes",

x="Payment Method",

y="Volume"

)

```

##Figure Interactive Visualization

```

{r fig8}

interactive_plot <-

ggplot(payments,

aes(x=Year,

y=Digital_Payment_Volume,

text=paste("Year:",Year,

"<br>Volume:",Digital_Payment_Volume))) +

geom_line(color="blue",

size=1.2) +

geom_point(size=3)

ggplotly(interactive_plot,

tooltip="text")

```

## Conclusion

The analysis demonstrates a strong relationship between internet penetration, e-commerce growth, and digital payment adoption in India. UPI has become the dominant payment mechanism, contributing significantly to India's transition toward a digital economy. The findings indicate continued opportunities for retail businesses to leverage digital channels and payment technologies to enhance customer engagement and business performance.