survey <- data.frame(
ID = 1:22,
CS_helpful = c(2,1,2,3,2,1,2,1,1,1,1,1,1,1,1,1,1,2,3,2,2,3),
Recommend = c(2,2,1,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,1,2),
Come_again = c(2,1,1,2,3,3,1,1,1,1,1,1,1,1,1,2,1,1,2,3,1,1),
All_Products = c(2,1,1,4,5,2,2,2,2,1,2,2,1,2,4,2,2,1,3,1,2,2),
Professionalism = c(2,1,1,1,2,1,2,1,2,1,1,1,1,1,1,1,1,1,2,3,2,2),
Limitation = c(2,1,2,2,1,1,1,2,1,1,1,1,1,1,1,1,2,3,4,1,1,2),
Online_grocery = c(2,2,3,3,2,1,2,1,2,3,2,3,1,3,2,3,2,3,1,3,3,3),
delivery = c(3,3,3,3,3,2,2,1,1,2,2,2,2,3,2,1,3,3,3,3,3,3),
Pick_up = c(4,3,2,2,1,1,2,2,3,2,2,3,2,3,2,3,5,3,1,1,4,3),
Find_items = c(1,1,1,2,2,1,1,2,1,1,1,1,1,3,2,1,2,1,3,1,1,2),
other_shops = c(2,2,3,2,3,4,1,4,1,1,3,3,1,1,5,5,5,2,2,4,2,1),
Gender = c(1,1,1,1,2,1,1,1,2,2,2,1,1,1,1,1,1,1,2,2,1,1),
Age = c(2,2,2,3,4,2,2,2,2,2,4,3,4,3,2,3,2,2,2,2,2,2),
Education = c(2,2,2,5,2,5,3,2,1,2,5,1,5,5,5,5,1,5,2,3,2,5)
)
head(survey)
## ID CS_helpful Recommend Come_again All_Products Professionalism 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
barplot(
table(survey$Recommend),
main = "Recommendation Responses",
xlab = "Response",
ylab = "Number of Respondents",
col = "steelblue"
)
barplot(
table(survey$Come_again),
main = "Come Again Responses",
xlab = "Response",
ylab = "Number of Respondents",
col = "darkorange"
)
service_means <- c(
"Helpful" = mean(survey$CS_helpful),
"Recommend" = mean(survey$Recommend),
"Come Again" = mean(survey$Come_again),
"Products" = mean(survey$All_Products),
"Professionalism" = mean(survey$Professionalism),
"Limitation" = mean(survey$Limitation)
)
barplot(
service_means,
main = "Average Customer Service Responses",
xlab = "Survey Question",
ylab = "Average Response",
col = "seagreen",
las = 2,
ylim = c(0, 5)
)
shopping_means <- c(
"Online Grocery" = mean(survey$Online_grocery),
"Delivery" = mean(survey$delivery),
"Pick Up" = mean(survey$Pick_up),
"Find Items" = mean(survey$Find_items),
"Other Shops" = mean(survey$other_shops)
)
barplot(
shopping_means,
main = "Average Shopping Experience Responses",
ylab = "Average Response",
col = "mediumpurple",
las = 2,
ylim = c(0, 5)
)
barplot(
table(survey$Gender),
main = "Gender Distribution",
xlab = "Gender Code",
ylab = "Number of Respondents",
col = "skyblue"
)
barplot(
table(survey$Age),
main = "Age Distribution",
xlab = "Age Code",
ylab = "Number of Respondents",
col = "coral"
)
library(plotly)
plot_data <- data.frame(
Category = names(service_means),
Average = as.numeric(service_means)
)
fig <- plot_ly(
data = plot_data,
x = ~Category,
y = ~Average,
type = "bar",
text = ~paste(
"Category:", Category,
"<br>Average:", round(Average, 2)
),
hoverinfo = "text"
)
fig <- fig %>%
layout(
title = "Interactive Customer Service Results",
xaxis = list(title = "Survey Category"),
yaxis = list(
title = "Average Response",
range = c(0,5)
)
)
fig
The dataset contains the following number of respondents:
nrow(survey)
## [1] 22
The recommendation responses are:
table(survey$Recommend)
##
## 1 2 3
## 17 3 2
The mean recommendation score calculated automatically is:
mean(survey$Recommend)
## [1] 1.318182
The same mean can be verified manually:
sum(survey$Recommend) / nrow(survey)
## [1] 1.318182
Both values should be identical.
The survey data were analyzed using descriptive statistics and visualizations. The graphs show the distributions of several important survey variables as well as the average responses for customer service and shopping experience questions.
The interactive Plotly visualization provides another way to examine the customer service results. However, the numeric response codes should be interpreted using the original survey questionnaire before deciding whether higher or lower values represent more positive responses.