The following document summarizes and provides insight into a Customer_Sentiment csv file.
library(readr)
customer_sentiment <- read_csv("Customer_Sentiment.csv")
library(tidyverse)
Structure
str(customer_sentiment)
## spc_tbl_ [25,000 × 13] (S3: spec_tbl_df/tbl_df/tbl/data.frame)
## $ customer_id : num [1:25000] 1 2 3 4 5 6 7 8 9 10 ...
## $ gender : chr [1:25000] "male" "other" "female" "female" ...
## $ age_group : chr [1:25000] "60+" "46-60" "36-45" "18-25" ...
## $ region : chr [1:25000] "north" "central" "east" "central" ...
## $ product_category : chr [1:25000] "automobile" "books" "sports" "groceries" ...
## $ purchase_channel : chr [1:25000] "online" "online" "online" "online" ...
## $ platform : chr [1:25000] "flipkart" "swiggy instamart" "facebook marketplace" "zepto" ...
## $ customer_rating : num [1:25000] 1 5 1 2 3 5 4 5 3 5 ...
## $ review_text : chr [1:25000] "very disappointed with the quality." "fast delivery and great packaging." "very disappointed with the quality." "product stopped working after few days." ...
## $ sentiment : chr [1:25000] "negative" "positive" "negative" "negative" ...
## $ response_time_hours : num [1:25000] 46 5 38 16 15 10 38 53 7 56 ...
## $ issue_resolved : chr [1:25000] "yes" "yes" "yes" "yes" ...
## $ complaint_registered: chr [1:25000] "yes" "no" "yes" "yes" ...
## - attr(*, "spec")=
## .. cols(
## .. customer_id = col_double(),
## .. gender = col_character(),
## .. age_group = col_character(),
## .. region = col_character(),
## .. product_category = col_character(),
## .. purchase_channel = col_character(),
## .. platform = col_character(),
## .. customer_rating = col_double(),
## .. review_text = col_character(),
## .. sentiment = col_character(),
## .. response_time_hours = col_double(),
## .. issue_resolved = col_character(),
## .. complaint_registered = col_character()
## .. )
## - attr(*, "problems")=<pointer: 0x151e1f780>
Dimension
dim(customer_sentiment)
## [1] 25000 13
Names of Variables
names(customer_sentiment)
## [1] "customer_id" "gender" "age_group"
## [4] "region" "product_category" "purchase_channel"
## [7] "platform" "customer_rating" "review_text"
## [10] "sentiment" "response_time_hours" "issue_resolved"
## [13] "complaint_registered"
Summary of Customer Sentiment
summary(customer_sentiment)
## customer_id gender age_group region
## Min. : 1 Length :25000 Length :25000 Length :25000
## 1st Qu.: 6251 N.unique : 3 N.unique : 5 N.unique : 5
## Median :12500 N.blank : 0 N.blank : 0 N.blank : 0
## Mean :12500 Min.nchar: 4 Min.nchar: 3 Min.nchar: 4
## 3rd Qu.:18750 Max.nchar: 6 Max.nchar: 5 Max.nchar: 7
## Max. :25000
## product_category purchase_channel platform customer_rating
## Length :25000 Length :25000 Length :25000 Min. :1.000
## N.unique : 9 N.unique : 1 N.unique : 20 1st Qu.:2.000
## N.blank : 0 N.blank : 0 N.blank : 0 Median :3.000
## Min.nchar: 5 Min.nchar: 6 Min.nchar: 4 Mean :3.002
## Max.nchar: 14 Max.nchar: 6 Max.nchar: 20 3rd Qu.:4.000
## Max. :5.000
## review_text sentiment response_time_hours issue_resolved
## Length :25000 Length :25000 Min. : 1.00 Length :25000
## N.unique : 15 N.unique : 3 1st Qu.:18.00 N.unique : 2
## N.blank : 0 N.blank : 0 Median :36.00 N.blank : 0
## Min.nchar: 20 Min.nchar: 7 Mean :36.02 Min.nchar: 2
## Max.nchar: 41 Max.nchar: 8 3rd Qu.:54.00 Max.nchar: 3
## Max. :71.00
## complaint_registered
## Length :25000
## N.unique : 2
## N.blank : 0
## Min.nchar: 2
## Max.nchar: 3
##
Factors of Product Categories
product_factor <- as.factor(customer_sentiment$product_category)
levels(product_factor)
## [1] "automobile" "beauty" "books" "electronics"
## [5] "fashion" "groceries" "home & kitchen" "sports"
## [9] "travel"
summary(product_factor)
## automobile beauty books electronics fashion
## 2833 2690 2812 2725 2782
## groceries home & kitchen sports travel
## 2858 2726 2763 2811
Frequency of Compliants for Fashion
customer_sentiment %>%
filter(sentiment == "negative" & gender == "female") %>%
ggplot(aes(x = product_category)) +
geom_bar(fill = "#CD6839") +
labs(title = "Compliants Registered by Product Category",
x = "Product Category",
y = "Number of Compliants"
)
Scatterplot
ggplot(
customer_sentiment,
aes(x = customer_sentiment$customer_rating, fill = sentiment)
) +
geom_bar() +
labs(
title = "Customer Sentiment based on Customer Satisfaction Rating",
x = "Customer Rating",
y = "Customer Count"
)