———————————————————————————————————————————————————————-
#Ensuring loading of necessary libraries
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)
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ forcats 1.0.0 ✔ stringr 1.5.1
## ✔ lubridate 1.9.4 ✔ tibble 3.2.1
## ✔ purrr 1.0.2 ✔ tidyr 1.3.1
## ✔ readr 2.1.5
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
What is the distribution of product prices?
ggplot(clean_data, aes(x = Item_MRP)) +
geom_histogram(binwidth = 10, fill = "skyblue", color = "black") +
labs(title = "Distribution of Product Prices", x = "price", y = "count")

Result : The histogram shows that most product prices are clustered
between 0 to 200, with fewer products priced above 200. The distribution
is slightly right-skewed, indicating some higher-priced products.
How do ratings distribute across products?
ggplot(clean_data, aes(x = rating)) +
geom_histogram(binwidth = 0.5, fill = "purple", color = "white") +
labs(title = "Distribution of Product Ratings", x = "Rating", y = "Count")

Result : The histogram shows that most product ratings are between 4
and 5, with a large number of products receiving high ratings. Lower
ratings are much less common.
What is the average price by category?
clean_data %>%
group_by(Item_Type) %>%
summarise(Average_Price = mean(Item_MRP, na.rm = TRUE)) %>%
ggplot(aes(x = reorder(Item_Type, -Average_Price), y = Average_Price)) +
geom_bar(stat = "identity", fill = "forestgreen") +
labs(title = "Average Price by category", x = "category", y = "average price") +
coord_flip()

Result : The bar chart shows that certain categories like Seafood
and Snack Foods have the highest average prices, while items like Dairy
Products are priced lower.
How do ratings distribute across products?
ggplot(clean_data, aes(x = rating)) +
geom_histogram(binwidth = 0.5, fill = "purple", color = "white") +
labs(title = "Distribution of Product Ratings", x = "Rating", y = "Count")

Result : The histogram shows that most products have ratings between
4 and 5, with 4.5 being the most common. Very few products have ratings
below 3.
How many outlets exist for each outlet size?
ggplot(clean_data, aes(x = Outlet_Size)) +
geom_bar(fill = "steelblue") +
labs(title = "Count of Outlets by Size", x = "Outlet Size", y = "Count") +
theme_minimal()

Result : The bar plot shows that Medium-sized outlets are the most
common, followed by Small outlets, while High outlet sizes are the least
common.
What is the distribution of product visibility?
ggplot(clean_data, aes(x = Item_Visibility)) +
geom_histogram(binwidth = 0.01, fill = "orchid", color = "black") +
labs(title = "Distribution of Product Visibility", x = "Visibility", y = "Count") +
theme_minimal()

Result : The histogram shows that most products have very low
visibility, with a large concentration near 0 and very few products
having high visibility values.
What is the count of items per outlet identifier (Outlet ID)?
ggplot(clean_data, aes(x = Outlet_Identifier)) +
geom_bar(fill = "slateblue") +
labs(title = "Item Count per Outlet", x = "Outlet ID", y = "Count") +
theme_minimal()

Result :The bar plot shows that some outlets, like OUT045, have a
higher number of items, while others have significantly fewer.
What is the most common item type in the data set?
clean_data %>%
count(Item_Type, sort = TRUE) %>%
ggplot(aes(x = reorder(Item_Type, n), y = n)) +
geom_bar(stat = "identity", fill = "skyblue", color = "black") +
labs(title = "Most Common Item Types", x = "Item Type", y = "Count") +
theme_minimal() +
coord_flip()

Result :The bar plot shows that Fruits and Vegetables are the most
common item type, followed by Snack Foods and Household products. Some
categories have much fewer items.
Is there a correlation between Item MRP and Rating?
ggplot(clean_data, aes(x = Item_MRP, y = rating)) +
geom_point(alpha = 0.5, color = "dodgerblue") +
labs(title = "Relationship between Item MRP and Rating",
x = "Item MRP", y = "Rating") +
theme_minimal()

Result :The scatter plot shows no strong relationship between Item
MRP and Rating — products across all price ranges tend to have similar
ratings.
What is the distribution of item outlet sales in the data set?
ggplot(clean_data, aes(x = Item_Outlet_Sales)) +
geom_histogram(binwidth = 500, fill = "skyblue", color = "black") +
labs(title = "Distribution of Item Outlet Sales",
x = "Sales (in currency units)", y = "Count of Items") +
theme_minimal()

Result : The histogram shows that most products have low outlet
sales, with the majority clustered below 6000 units, while very few
products achieve very high sales.
Is there a relationship between customer sentiment and product
rating in the data set?
ggplot(clean_data, aes(x = sentiment, y = rating)) +
geom_boxplot(fill = "lightgreen", color = "black") +
labs(title = "Product Ratings by Sentiment",
x = "Sentiment", y = "Rating") +
theme_minimal()

Result : The boxplot shows that products with positive sentiment
generally have higher ratings, while negative sentiment products tend to
have lower ratings.
Do sales vary with the type of outlet tier?
ggplot(clean_data, aes(x = Outlet_Location_Type, y = Item_Outlet_Sales)) +
geom_jitter(width = 0.2, alpha = 0.5, color = "forestgreen") +
labs(title = "Outlet Tier vs Item Outlet Sales",
x = "Outlet Tier", y = "Item Outlet Sales") +
theme_minimal()

Result : The jitter plot shows that outlets across all tiers have a
wide range of sales, but Tier 3 outlets seem to have more items with
higher sales compared to Tier 1 and Tier 2.
———————————————————————————————————————————————————————–
Summary and Findings
- Product Pricing: Most products are affordable, priced under 200
currency units, making them accessible to a wide range of
customers.
- Product Ratings: The majority of products have high ratings
between 4 and 5, indicating overall good customer satisfaction.
- Item Types: Fruits and Vegetables are the most common item types
in the dataset, followed by Snack Foods and Household products.
- Outlet Sizes: Medium-sized outlets are the most frequent,
suggesting that Blinkit prefers moderate-sized stores to optimize space
and cost.
- Sales Distribution: Most items have low to moderate sales, with a
few products achieving very high sales, creating a right-skewed
distribution.
- Visibility: Most products have very low visibility, meaning they
are less prominently displayed in stores.
- Sentiment vs. Rating: Products with positive sentiment are usually
associated with higher ratings, showing that customer experience
strongly impacts ratings.
- Price vs. Rating Correlation: There is no strong relationship
between product price and customer ratings; expensive products are not
necessarily rated better.