This report analyzes the customer_segmentation.csv dataset to understand customer satisfaction, shopping preferences, and demographic patterns.
if (!require(tidyverse)) install.packages("tidyverse")
## Loading required package: tidyverse
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.2.0 ✔ readr 2.2.0
## ✔ forcats 1.0.1 ✔ stringr 1.6.0
## ✔ ggplot2 4.0.2 ✔ tibble 3.3.1
## ✔ lubridate 1.9.5 ✔ tidyr 1.3.2
## ✔ purrr 1.2.1
## ── 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
if (!require(ggplot2)) install.packages("ggplot2")
library(tidyverse)
library(ggplot2)
data <- read.csv("customer_segmentation.csv")
colnames(data) <- trimws(colnames(data))
str(data)
## 'data.frame': 22 obs. of 15 variables:
## $ ID : int 1 2 3 4 5 6 7 8 9 10 ...
## $ CS_helpful : int 2 1 2 3 2 1 2 1 1 1 ...
## $ Recommend : int 2 2 1 3 1 1 1 1 1 1 ...
## $ Come_again : int 2 1 1 2 3 3 1 1 1 1 ...
## $ All_Products : int 2 1 1 4 5 2 2 2 2 1 ...
## $ Profesionalism: int 2 1 1 1 2 1 2 1 2 1 ...
## $ Limitation : int 2 1 2 2 1 1 1 2 1 1 ...
## $ Online_grocery: int 2 2 3 3 2 1 2 1 2 3 ...
## $ delivery : int 3 3 3 3 3 2 2 1 1 2 ...
## $ Pick_up : int 4 3 2 2 1 1 2 2 3 2 ...
## $ Find_items : int 1 1 1 2 2 1 1 2 1 1 ...
## $ other_shops : int 2 2 3 2 3 4 1 4 1 1 ...
## $ Gender : int 1 1 1 1 2 1 1 1 2 2 ...
## $ Age : int 2 2 2 3 4 2 2 2 2 2 ...
## $ Education : int 2 2 2 5 2 5 3 2 1 2 ...
head(data)
## ID CS_helpful Recommend Come_again All_Products Profesionalism Limitation
## 1 1 2 2 2 2 2 2
## 2 2 1 2 1 1 1 1
## 3 3 2 1 1 1 1 2
## 4 4 3 3 2 4 1 2
## 5 5 2 1 3 5 2 1
## 6 6 1 1 3 2 1 1
## Online_grocery delivery Pick_up Find_items other_shops Gender Age Education
## 1 2 3 4 1 2 1 2 2
## 2 2 3 3 1 2 1 2 2
## 3 3 3 2 1 3 1 2 2
## 4 3 3 2 2 2 1 3 5
## 5 2 3 1 2 3 2 4 2
## 6 1 2 1 1 4 1 2 5
summary(data)
## ID CS_helpful Recommend Come_again
## Min. : 1.00 Min. :1.000 Min. :1.000 Min. :1.000
## 1st Qu.: 6.25 1st Qu.:1.000 1st Qu.:1.000 1st Qu.:1.000
## Median :11.50 Median :1.000 Median :1.000 Median :1.000
## Mean :11.50 Mean :1.591 Mean :1.318 Mean :1.455
## 3rd Qu.:16.75 3rd Qu.:2.000 3rd Qu.:1.000 3rd Qu.:2.000
## Max. :22.00 Max. :3.000 Max. :3.000 Max. :3.000
## All_Products Profesionalism Limitation Online_grocery delivery
## Min. :1.000 Min. :1.000 Min. :1.0 Min. :1.000 Min. :1.000
## 1st Qu.:1.250 1st Qu.:1.000 1st Qu.:1.0 1st Qu.:2.000 1st Qu.:2.000
## Median :2.000 Median :1.000 Median :1.0 Median :2.000 Median :3.000
## Mean :2.091 Mean :1.409 Mean :1.5 Mean :2.273 Mean :2.409
## 3rd Qu.:2.000 3rd Qu.:2.000 3rd Qu.:2.0 3rd Qu.:3.000 3rd Qu.:3.000
## Max. :5.000 Max. :3.000 Max. :4.0 Max. :3.000 Max. :3.000
## Pick_up Find_items other_shops Gender
## Min. :1.000 Min. :1.000 Min. :1.000 Min. :1.000
## 1st Qu.:2.000 1st Qu.:1.000 1st Qu.:1.250 1st Qu.:1.000
## Median :2.000 Median :1.000 Median :2.000 Median :1.000
## Mean :2.455 Mean :1.455 Mean :2.591 Mean :1.273
## 3rd Qu.:3.000 3rd Qu.:2.000 3rd Qu.:3.750 3rd Qu.:1.750
## Max. :5.000 Max. :3.000 Max. :5.000 Max. :2.000
## Age Education
## Min. :2.000 Min. :1.000
## 1st Qu.:2.000 1st Qu.:2.000
## Median :2.000 Median :2.500
## Mean :2.455 Mean :3.182
## 3rd Qu.:3.000 3rd Qu.:5.000
## Max. :4.000 Max. :5.000
colSums(is.na(data))
## ID CS_helpful Recommend Come_again All_Products
## 0 0 0 0 0
## Profesionalism Limitation Online_grocery delivery Pick_up
## 0 0 0 0 0
## Find_items other_shops Gender Age Education
## 0 0 0 0 0
ggplot(data, aes(x = factor(CS_helpful))) +
geom_bar(fill = "steelblue")
ggplot(data, aes(x = factor(Recommend))) +
geom_bar(fill = "darkgreen")
ggplot(data, aes(x = factor(Come_again))) +
geom_bar(fill = "purple")
Customer satisfaction varies across respondents, indicating differences in service experience.
ggplot(data, aes(x = factor(Online_grocery))) +
geom_bar(fill = "orange")
ggplot(data, aes(x = factor(delivery))) +
geom_bar(fill = "red")
ggplot(data, aes(x = factor(Pick_up))) +
geom_bar(fill = "blue")
Customers show different preferences between online shopping, delivery, and pickup options.
ggplot(data, aes(x = factor(Gender))) +
geom_bar(fill = "pink")
ggplot(data, aes(x = factor(Age))) +
geom_bar(fill = "cyan")
ggplot(data, aes(x = factor(Education))) +
geom_bar(fill = "gold")
Demographic differences help explain variation in shopping behavior.
numeric_data <- data %>% select(where(is.numeric))
cor(numeric_data, use = "complete.obs")
## ID CS_helpful Recommend Come_again All_Products
## ID 1.00000000 0.15482785 -0.08509414 -0.12908035 -0.11705779
## CS_helpful 0.15482785 1.00000000 0.48809623 0.27146195 0.29345435
## Recommend -0.08509414 0.48809623 1.00000000 0.38089069 0.02515624
## Come_again -0.12908035 0.27146195 0.38089069 1.00000000 0.36875582
## All_Products -0.11705779 0.29345435 0.02515624 0.36875582 1.00000000
## Profesionalism 0.25465839 0.51442802 0.39143306 0.42695809 0.08951478
## Limitation 0.19664246 0.60674478 0.04594474 0.00000000 0.05576720
## Online_grocery 0.23893106 0.20749595 0.29678764 -0.14514393 -0.14833305
## delivery 0.09489449 0.59036145 0.41510987 0.16766768 0.07197937
## Pick_up 0.15959528 -0.17854819 -0.08238912 -0.52135402 -0.25000740
## Find_items 0.24044075 0.29879792 -0.01996410 0.04367853 0.53916624
## other_shops 0.09671790 -0.30898381 -0.05968695 0.32594355 0.21734201
## Gender 0.08043618 0.06467921 0.01469318 0.32146531 0.14267528
## Age -0.10922184 -0.16766768 -0.11789474 0.12698413 0.30821382
## Education 0.21244579 0.06542384 0.12385279 0.08671100 0.07266003
## Profesionalism Limitation Online_grocery delivery
## ID 0.25465839 0.19664246 0.23893106 0.09489449
## CS_helpful 0.51442802 0.60674478 0.20749595 0.59036145
## Recommend 0.39143306 0.04594474 0.29678764 0.41510987
## Come_again 0.42695809 0.00000000 -0.14514393 0.16766768
## All_Products 0.08951478 0.05576720 -0.14833305 0.07197937
## Profesionalism 1.00000000 0.05030388 0.05734345 0.25471679
## Limitation 0.05030388 1.00000000 -0.15480679 0.36404687
## Online_grocery 0.05734345 -0.15480679 1.00000000 0.29971638
## delivery 0.25471679 0.36404687 0.29971638 1.00000000
## Pick_up -0.15959528 0.00000000 0.30963403 0.11717225
## Find_items -0.01092912 0.44257084 -0.15975979 0.28122157
## other_shops -0.19082180 -0.06351171 -0.11262158 -0.19968341
## Gender 0.45044262 0.00000000 -0.08663791 -0.06467921
## Age -0.22837293 -0.32166527 -0.06111323 -0.09581010
## Education -0.28024764 -0.07321628 0.07302945 -0.02544260
## Pick_up Find_items other_shops Gender Age
## ID 0.15959528 0.240440748 0.096717897 0.08043618 -0.10922184
## CS_helpful -0.17854819 0.298797921 -0.308983807 0.06467921 -0.16766768
## Recommend -0.08238912 -0.019964097 -0.059686954 0.01469318 -0.11789474
## Come_again -0.52135402 0.043678535 0.325943546 0.32146531 0.12698413
## All_Products -0.25000740 0.539166240 0.217342007 0.14267528 0.30821382
## Profesionalism -0.15959528 -0.010929125 -0.190821797 0.45044262 -0.22837293
## Limitation 0.00000000 0.442570837 -0.063511705 0.00000000 -0.32166527
## Online_grocery 0.30963403 -0.159759789 -0.112621585 -0.08663791 -0.06111323
## delivery 0.11717225 0.281221573 -0.199683413 -0.06467921 -0.09581010
## Pick_up 1.00000000 -0.103782087 -0.029202713 -0.46727535 -0.21630646
## Find_items -0.10378209 1.000000000 0.004599561 0.04246039 0.04367853
## other_shops -0.02920271 0.004599561 1.000000000 -0.11509630 -0.04178763
## Gender -0.46727535 0.042460389 -0.115096299 1.00000000 0.18002057
## Age -0.21630646 0.043678535 -0.041787634 0.18002057 1.00000000
## Education -0.24491202 0.095442714 0.013316169 -0.26341476 0.32516624
## Education
## ID 0.21244579
## CS_helpful 0.06542384
## Recommend 0.12385279
## Come_again 0.08671100
## All_Products 0.07266003
## Profesionalism -0.28024764
## Limitation -0.07321628
## Online_grocery 0.07302945
## delivery -0.02544260
## Pick_up -0.24491202
## Find_items 0.09544271
## other_shops 0.01331617
## Gender -0.26341476
## Age 0.32516624
## Education 1.00000000
This analysis shows variation in customer satisfaction, adoption of online grocery services, and differences in delivery preferences. These insights can help businesses better segment customers and improve marketing strategies.