# Cleaning and converstion of price to Numeric
swiggy <- swiggy %>%
  mutate(
    Price..INR. = as.numeric(gsub("[^0-9.]", "", Price..INR.)) # remove commas, ₹, etc.
  )

summary(swiggy$Price..INR.)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    0.95  139.00  229.00  268.51  329.00 8000.00

## Average Price by City

``` r
avg_price_city <- swiggy %>%
  group_by(City) %>%
  summarise(avg_price = mean(Price..INR., na.rm = TRUE)) %>%
  arrange(desc(avg_price))

head(avg_price_city)
## # A tibble: 6 × 2
##   City       avg_price
##   <chr>          <dbl>
## 1 Panaji          306.
## 2 Lucknow         306.
## 3 Hyderabad       293.
## 4 Gurgaon         287.
## 5 Mumbai          287.
## 6 Chandigarh      279.
ggplot(avg_price_city, aes(x = reorder(City, avg_price), y = avg_price)) +
  geom_col(fill = "steelblue") +
  coord_flip() +
  labs(title = "Average Dish Price by City", x = "City", y = "Average Price (INR)")

Explanation:
This chart shows which cities have the highest average dish prices.
It helps identify premium markets where customers are willing to spend more, which can guide pricing strategies.


Top Restaurants by Number of Dishes

top_restaurants <- swiggy %>%
  count(Restaurant.Name, sort = TRUE) %>%
  slice_head(n = 10)

top_restaurants
##                        Restaurant.Name     n
## 1                           McDonald's 13530
## 2                                  KFC 12961
## 3                          Burger King  7116
## 4                            Pizza Hut  6529
## 5                       Domino's Pizza  5492
## 6          LunchBox - Meals and Thalis  4700
## 7  Baskin Robbins - Ice Cream Desserts  4197
## 8     Faasos - Wraps, Rolls & Shawarma  3256
## 9       Olio - The Wood Fired Pizzeria  3241
## 10                       The Good Bowl  2665
ggplot(top_restaurants, aes(x = reorder(Restaurant.Name, n), y = n)) +
  geom_col(fill = "darkorange") +
  coord_flip() +
  labs(title = "Top 10 Restaurants by Number of Dishes",
       x = "Restaurant", y = "Number of Dishes")

Explanation:
This bar chart highlights the top 10 restaurants with the most dishes listed on Swiggy.
Restaurants with large menus may attract a wide range of customers but could also face operational complexity.


️ Most Common Dish Categories

top_categories <- swiggy %>%
  count(Category, sort = TRUE) %>%
  slice_head(n = 10)

top_categories
##                           Category     n
## 1                      Recommended 24100
## 2                      Main Course  2959
## 3                         Desserts  2944
## 4                        Beverages  2464
## 5      McSaver Combos (2 Pc Meals)  1885
## 6  Exclusive Deals (Save upto 40%)  1717
## 7                           Sweets  1715
## 8                         Starters  1673
## 9                           Breads  1422
## 10                          Snacks  1387
ggplot(top_categories, aes(x = reorder(Category, n), y = n)) +
  geom_col(fill = "darkgreen") +
  coord_flip() +
  labs(title = "Top 10 Dish Categories", x = "Category", y = "Count")

Explanation:
This visualization shows the most common food categories across India on Swiggy.
It provides insight into popular cuisine preferences — useful for menu planning and promotions.


Price vs Rating Relationship

swiggy %>%
  group_by(price_bin = cut(Price..INR., breaks = seq(0, 2000, 100))) %>%
  summarise(avg_rating = mean(Rating, na.rm = TRUE)) %>%
  ggplot(aes(x = price_bin, y = avg_rating)) +
  geom_col(fill = "purple") +
  theme(axis.text.x = element_text(angle = 45, hjust = 1)) +
  labs(title = "Average Rating by Price Range",
       x = "Price Range (INR)", y = "Average Rating")

Explanation:
This chart shows how customer ratings vary across different price ranges.
It can help identify whether higher-priced dishes tend to get better ratings, which is useful for understanding customer satisfaction.

📈 Business Insights & Conclusion

Key Insights from the Analysis:

  1. City Price Variation:
    Some cities have significantly higher average dish prices.
    • Implication: These markets can sustain premium pricing strategies or exclusive offerings.
    • Action: Focus promotions or partnerships with high-value restaurants in these cities.
  2. Top Restaurants with Large Menus:
    A few restaurants dominate in terms of number of dishes.
    • Implication: They are major players on Swiggy and can attract more customers through variety.
    • Action: Collaborate with these restaurants for targeted marketing or featured placements.
  3. Most Popular Categories:
    Certain food categories (like biryani, pizza, beverages) appear frequently across cities.
    • Implication: These are crowd favorites and consistently drive demand.
    • Action: Recommend these categories to new restaurants or promote combo deals around them.
  4. Price vs Rating Trend:
    The analysis shows that mid-range dishes (₹300–₹700) often have higher ratings compared to very cheap or very expensive ones.
    • Implication: Customers are most satisfied with reasonably priced, good-quality dishes.
    • Action: Encourage restaurants to optimize menu pricing in this sweet spot.

Overall Conclusion:
The Swiggy Restaurant India menu data reveals that pricing, menu variety, and category popularity play a big role in customer engagement.
By leveraging these insights, Swiggy can: - Optimize pricing strategies city-by-city.
- Build partnerships with top-menu restaurants.
- Promote high-demand categories to boost orders.
- Encourage restaurants to price dishes in the range that yields the best ratings.

These actions will likely improve customer satisfaction, order volume, and revenue growth.