1 Executive Summary

This notebook explores the raw, de-identified Foresta student survey to understand ordering and collection preferences relevant to Part 1 Research Question 4: “What is the optimal solution for the product delivery process problem, when there are many ordering methods at the same time?”

The analysis uses Q10 as the preferred delivery arrangement, Q18 as the perceived value of accurate order information, and Q19 as the perceived value of real-time order tracking. Q7, Q9, Q14 and Q17 provide supporting context.

The uploaded raw dataset contains survey responses for Q1–Q20. It does not contain separate respondent ID or survey timestamp columns. Therefore, this notebook analyzes the 20 survey questions directly and does not treat submission time as a measure of purchasing time.

2 Data Overview & EDA

2.1 1. Import raw dataset

Place Foresta_Raw_Deidentified.csv in the same folder as this R Markdown file, or change data_path below. Keep the raw file unchanged.

data_path <- "Foresta_Raw_Deidentified.csv"

raw_original <- readr::read_csv(
  data_path,
  show_col_types = FALSE,
  name_repair = "minimal"
)

if (ncol(raw_original) != 20) {
  stop(
    "Expected 20 survey columns (Q1-Q20), but found ",
    ncol(raw_original),
    ". Please check that the correct CSV file is being used."
  )
}

# The CSV contains the 20 survey questions but no respondent_id or timestamp.
# Assign short names based on the question order in the questionnaire.
raw <- raw_original
names(raw) <- paste0("q", 1:20)

# Convert Likert responses Q11-Q20 to numeric values.
raw <- raw |>
  mutate(
    across(
      all_of(paste0("q", 11:20)),
      ~ suppressWarnings(as.integer(as.character(.x)))
    )
  )

cat("Rows:", nrow(raw), "| Columns:", ncol(raw))
## Rows: 59 | Columns: 20

2.2 2. Data Overview

The table below reports the number of rows and columns and, for every variable, its data type, number of unique values, missing values and zero values. Since the source file does not contain a respondent ID, each row is treated as one survey response for this preliminary EDA.

variable_overview <- tibble(
  variable = names(raw),
  type = map_chr(raw, ~ paste(class(.x), collapse = "/")),
  unique_values = map_int(raw, ~ n_distinct(.x, na.rm = TRUE)),
  missing_values = map_int(raw, ~ sum(is.na(.x))),
  zero_values = map_int(
    raw,
    ~ if (is.numeric(.x)) sum(.x == 0, na.rm = TRUE) else NA_integer_
  ),
  example_value = map_chr(raw, ~ {
    z <- na.omit(as.character(.x))
    if (length(z) == 0) NA_character_ else str_trunc(z[1], 65)
  })
)

file_overview <- tibble(
  rows = nrow(raw),
  columns = ncol(raw),
  duplicate_rows = sum(duplicated(raw))
)

knitr::kable(file_overview, caption = "Dataset-level overview")
Dataset-level overview
rows columns duplicate_rows
59 20 0
knitr::kable(variable_overview, caption = "Variable-level overview")
Variable-level overview
variable type unique_values missing_values zero_values example_value
q1 character 4 0 NA A. Long waiting time / Thời gian chờ lâu
q2 character 5 0 NA B. 3–5 minutes / 3–5 phút
q3 character 4 0 NA E. Drink quality inconsistency / Chất lượng đồ uống không ổn định
q4 character 5 1 NA C. Lunchtime / Giờ ăn trưa
q5 character 5 0 NA B. Slow order processing / Xử lý đơn hàng chậm
q6 character 5 0 NA B. Wait for the ingredients to be replenished / Chờ bổ sung ng…
q7 character 5 0 NA B. Ingredient preparation / Chuẩn bị nguyên liệu
q8 character 5 0 NA B. Ice melting or drinks becoming diluted (Đá tan làm đồ uống …
q9 character 5 0 NA B. Preparing ingredients in advance (Chuẩn bị nguyên liệu trước)
q10 character 5 0 NA B. Pickup at a designated campus collection point (Nhận tại đi…
q11 integer 5 0 0 4
q12 integer 5 0 0 4
q13 integer 5 0 0 4
q14 integer 5 0 0 5
q15 integer 5 0 0 5
q16 integer 5 0 0 5
q17 integer 5 0 0 5
q18 integer 5 0 0 5
q19 integer 5 0 0 5
q20 integer 5 0 0 5

Annotated finding: The overview establishes the raw sample size and identifies missing or structurally unusual fields before analysis. Check missing values and duplicate records in Step 2. Do not remove a respondent solely because one non-core survey answer is missing without documenting the rule.

2.3 3. Univariate Analysis – all variables

2.3.1 3.1 Dataset structure

The uploaded CSV contains survey answers only. It does not include respondent IDs or submission timestamps, so these fields cannot be analyzed. The following output summarizes the structure of the survey dataset.

cat("Number of survey responses:", nrow(raw), "\n")
## Number of survey responses: 59
cat("Number of survey questions:", ncol(raw), "\n")
## Number of survey questions: 20
cat("Number of completely duplicated rows:", sum(duplicated(raw)), "\n")
## Number of completely duplicated rows: 0
str(raw)
## tibble [59 × 20] (S3: tbl_df/tbl/data.frame)
##  $ q1 : chr [1:59] "A. Long waiting time / Thời gian chờ lâu" "A. Long waiting time / Thời gian chờ lâu" "B. Slow drink preparation / Pha chế chậm" "B. Slow drink preparation / Pha chế chậm" ...
##  $ q2 : chr [1:59] "B. 3–5 minutes / 3–5 phút" "B. 3–5 minutes / 3–5 phút" "D. 11–15 minutes / 11–15 phút" "A. Less than 3 minutes / Dưới 3 phút" ...
##  $ q3 : chr [1:59] "E. Drink quality inconsistency / Chất lượng đồ uống không ổn định" "B. Order accuracy / Độ chính xác của đơn hàng" "A. Long waiting time / Thời gian chờ lâu" "E. Drink quality inconsistency / Chất lượng đồ uống không ổn định" ...
##  $ q4 : chr [1:59] "C. Lunchtime / Giờ ăn trưa" "C. Lunchtime / Giờ ăn trưa" "C. Lunchtime / Giờ ăn trưa" "C. Lunchtime / Giờ ăn trưa" ...
##  $ q5 : chr [1:59] "B. Slow order processing / Xử lý đơn hàng chậm" "B. Slow order processing / Xử lý đơn hàng chậm" "A. Long queues / Hàng chờ kéo dài" "A. Long queues / Hàng chờ kéo dài" ...
##  $ q6 : chr [1:59] "B. Wait for the ingredients to be replenished / Chờ bổ sung nguyên liệu" "D. Purchase from another shop / Mua tại cửa hàng khác" "A. Choose another drink / Chọn món khác" "B. Wait for the ingredients to be replenished / Chờ bổ sung nguyên liệu" ...
##  $ q7 : chr [1:59] "B. Ingredient preparation / Chuẩn bị nguyên liệu" "A. Order taking / Tiếp nhận đơn hàng" "E. Queue management / Quản lý hàng chờ" "C. Drink preparation / Pha chế đồ uống" ...
##  $ q8 : chr [1:59] "B. Ice melting or drinks becoming diluted (Đá tan làm đồ uống bị loãng)" "B. Ice melting or drinks becoming diluted (Đá tan làm đồ uống bị loãng)" "E. Long delivery time (Thời gian giao hàng quá lâu)" "C. Incorrect drink temperature (Nhiệt độ đồ uống không phù hợp)" ...
##  $ q9 : chr [1:59] "B. Preparing ingredients in advance (Chuẩn bị nguyên liệu trước)" "C. Improving the drink preparation workflow (Cải tiến quy trình pha chế)" "E. Improving order allocation and queue management (Cải thiện việc phân bổ đơn hàng và quản lý hàng chờ)" "C. Improving the drink preparation workflow (Cải tiến quy trình pha chế)" ...
##  $ q10: chr [1:59] "B. Pickup at a designated campus collection point (Nhận tại điểm giao nhận tập trung trong trường)" "A. Pickup directly at the store (Tự đến cửa hàng nhận hàng)" "C. Delivery to a classroom or campus building (Giao đến lớp học hoặc tòa nhà trong trường)" "A. Pickup directly at the store (Tự đến cửa hàng nhận hàng)" ...
##  $ q11: int [1:59] 4 1 1 4 3 3 3 5 3 4 ...
##  $ q12: int [1:59] 4 1 5 5 5 4 3 5 3 4 ...
##  $ q13: int [1:59] 4 1 3 4 5 3 3 1 3 2 ...
##  $ q14: int [1:59] 5 1 3 4 5 4 3 1 3 3 ...
##  $ q15: int [1:59] 5 1 5 4 3 3 3 1 2 3 ...
##  $ q16: int [1:59] 5 1 5 3 5 3 3 1 3 4 ...
##  $ q17: int [1:59] 5 1 5 3 5 4 3 1 3 3 ...
##  $ q18: int [1:59] 5 1 5 2 5 3 3 1 2 4 ...
##  $ q19: int [1:59] 5 1 5 4 5 4 3 5 3 5 ...
##  $ q20: int [1:59] 5 1 5 3 5 3 3 5 3 5 ...

Annotated finding: Use this output to describe the size and structure of the collected survey. Duplicate rows should be reviewed in Step 2 before any decision is made about removing records.

2.3.2 3.2 Categorical questions Q1–Q10

Each categorical question is summarized by count and percentage, with a bar chart. The full response text is retained so that bilingual answer categories remain traceable to the questionnaire.

cat_vars <- paste0("q", 1:10)

for (v in cat_vars) {
  tab <- raw |>
    count(response = .data[[v]], name = "n", .drop = FALSE) |>
    mutate(percent = 100 * n / sum(n)) |>
    arrange(desc(n))

  cat("\n#### ", toupper(v), "\n\n", sep = "")

  print(knitr::kable(
    tab,
    digits = 1,
    caption = paste("Frequency distribution:", toupper(v))
  ))

  p <- ggplot(tab, aes(x = reorder(response, n), y = n)) +
    geom_col() +
    coord_flip() +
    labs(
      title = paste("Response distribution –", toupper(v)),
      x = NULL,
      y = "Number of respondents"
    ) +
    theme_minimal()

  print(p)
}

2.3.2.1 Q1

Frequency distribution: Q1
response n percent
A. Long waiting time / Thời gian chờ lâu 38 64.4
B. Slow drink preparation / Pha chế chậm 13 22.0
D. Difficulty collecting drinks / Khó khăn khi nhận đồ uống 6 10.2
C. Incorrect orders / Đơn hàng sai 2 3.4

#### Q2

Frequency distribution: Q2
response n percent
B. 3–5 minutes / 3–5 phút 28 47.5
C. 6–10 minutes / 6–10 phút 13 22.0
A. Less than 3 minutes / Dưới 3 phút 11 18.6
D. 11–15 minutes / 11–15 phút 6 10.2
E. More than 15 minutes / Trên 15 phút 1 1.7

#### Q3

Frequency distribution: Q3
response n percent
A. Long waiting time / Thời gian chờ lâu 34 57.6
E. Drink quality inconsistency / Chất lượng đồ uống không ổn định 12 20.3
C. Product availability / Khả năng cung ứng sản phẩm 8 13.6
B. Order accuracy / Độ chính xác của đơn hàng 5 8.5

#### Q4

Frequency distribution: Q4
response n percent
C. Lunchtime / Giờ ăn trưa 29 49.2
B. Between classes / Giờ nghỉ giữa các tiết học 13 22.0
E. No specific period / Không có khung giờ cố định 8 13.6
A. Morning / Buổi sáng 4 6.8
D. Afternoon / Buổi chiều 4 6.8
NA 1 1.7

#### Q5

Frequency distribution: Q5
response n percent
A. Long queues / Hàng chờ kéo dài 32 54.2
B. Slow order processing / Xử lý đơn hàng chậm 20 33.9
E. Product or ingredient shortages / Thiếu sản phẩm hoặc nguyên liệ 3 5.1
C. Incorrect drinks / Pha chế sai đồ uống 2 3.4
D. Confusion during drink collection / Nhầm lẫn khi nhận đồ uống 2 3.4

#### Q6

Frequency distribution: Q6
response n percent
A. Choose another drink / Chọn món khác 29 49.2
D. Purchase from another shop / Mua tại cửa hàng khác 14 23.7
C. Cancel the order / Hủy đơn hàng 6 10.2
B. Wait for the ingredients to be replenished / Chờ bổ sung nguyên liệu 5 8.5
E. This has never happened to me / Tôi chưa từng gặp trường hợp này 5 8.5

#### Q7

Frequency distribution: Q7
response n percent
E. Queue management / Quản lý hàng chờ 16 27.1
C. Drink preparation / Pha chế đồ uống 15 25.4
A. Order taking / Tiếp nhận đơn hàng 14 23.7
B. Ingredient preparation / Chuẩn bị nguyên liệu 12 20.3
D. Drink collection / Bàn giao đồ uống 2 3.4

#### Q8

Frequency distribution: Q8
response n percent
B. Ice melting or drinks becoming diluted (Đá tan làm đồ uống bị loãng) 34 57.6
E. Long delivery time (Thời gian giao hàng quá lâu) 13 22.0
C. Incorrect drink temperature (Nhiệt độ đồ uống không phù hợp) 6 10.2
A. Drinks spilling or leaking (Đồ uống bị đổ hoặc rò rỉ) 3 5.1
D. Damaged packaging (Bao bì bị hư hỏng) 3 5.1

#### Q9

Frequency distribution: Q9
response n percent
C. Improving the drink preparation workflow (Cải tiến quy trình pha chế) 15 25.4
A. Increasing the number of staff (Tăng số lượng nhân viên) 13 22.0
E. Improving order allocation and queue management (Cải thiện việc phân bổ đơn hàng và quản lý hàng chờ) 13 22.0
D. Using a pre-order system (Áp dụng hệ thống đặt hàng trước) 10 16.9
B. Preparing ingredients in advance (Chuẩn bị nguyên liệu trước) 8 13.6

#### Q10

Frequency distribution: Q10
response n percent
C. Delivery to a classroom or campus building (Giao đến lớp học hoặc tòa nhà trong trường) 22 37.3
A. Pickup directly at the store (Tự đến cửa hàng nhận hàng) 19 32.2
B. Pickup at a designated campus collection point (Nhận tại điểm giao nhận tập trung trong trường) 9 15.3
E. Scheduled group delivery to campus (Gộp nhiều đơn để giao cùng một chuyến đến trường) 8 13.6
D. Delivery by an independent rider (Giao qua tài xế độc lập) 1 1.7

Annotated finding: Compare the most frequent answer and the spread across categories for each question. For RQ4, pay particular attention to Q7 (process stage to improve), Q9 (preferred improvement to reduce waiting) and Q10 (preferred delivery arrangement). Do not infer staff capacity from preference counts alone.

2.3.3 3.3 Likert questions Q11–Q20

The Likert items use a 1–5 scale. Report the frequency distribution, median and interquartile range; the mean is included as a descriptive supplement, not as proof of an interval-scale effect.

likert_vars <- paste0("q", 11:20)

likert_summary <- map_dfr(likert_vars, function(v) {
  x <- raw[[v]]

  tibble(
    variable = toupper(v),
    n = sum(!is.na(x)),
    missing = sum(is.na(x)),
    mean = if (all(is.na(x))) NA_real_ else mean(x, na.rm = TRUE),
    median = if (all(is.na(x))) NA_real_ else median(x, na.rm = TRUE),
    q1 = if (all(is.na(x))) NA_real_ else
      as.numeric(quantile(x, .25, na.rm = TRUE)),
    q3 = if (all(is.na(x))) NA_real_ else
      as.numeric(quantile(x, .75, na.rm = TRUE)),
    agree_4_5_pct = if (all(is.na(x))) NA_real_ else
      mean(x %in% c(4, 5), na.rm = TRUE) * 100
  )
})

knitr::kable(
  likert_summary,
  digits = 2,
  caption = "Descriptive summary of Likert items"
)
Descriptive summary of Likert items
variable n missing mean median q1 q3 agree_4_5_pct
Q11 59 0 3.03 3 2 4 32.20
Q12 59 0 3.85 4 3 5 67.80
Q13 59 0 3.05 3 2 4 28.81
Q14 59 0 3.34 3 3 4 49.15
Q15 59 0 3.39 3 3 4 49.15
Q16 59 0 3.76 4 3 5 62.71
Q17 59 0 3.75 4 3 5 62.71
Q18 59 0 3.78 4 3 5 66.10
Q19 59 0 3.86 4 3 5 67.80
Q20 59 0 3.88 4 3 5 67.80
for (v in likert_vars) {
  tab <- raw |>
    filter(!is.na(.data[[v]])) |>
    count(score = factor(.data[[v]], levels = 1:5), name = "n") |>
    complete(score, fill = list(n = 0)) |>
    mutate(percent = if (sum(n) == 0) 0 else 100 * n / sum(n))

  cat("\n#### ", toupper(v), "\n\n", sep = "")

  print(knitr::kable(
    tab,
    digits = 1,
    caption = paste("Likert distribution:", toupper(v))
  ))

  print(
    ggplot(tab, aes(x = score, y = n)) +
      geom_col() +
      scale_x_discrete(drop = FALSE) +
      labs(
        title = paste("Likert response –", toupper(v)),
        x = "Rating (1 = strongly disagree; 5 = strongly agree)",
        y = "Number of respondents"
      ) +
      theme_minimal()
  )
}

2.3.3.1 Q11

Likert distribution: Q11
score n percent
1 7 11.9
2 10 16.9
3 23 39.0
4 12 20.3
5 7 11.9

#### Q12

Likert distribution: Q12
score n percent
1 2 3.4
2 3 5.1
3 14 23.7
4 23 39.0
5 17 28.8

#### Q13

Likert distribution: Q13
score n percent
1 3 5.1
2 14 23.7
3 25 42.4
4 11 18.6
5 6 10.2

#### Q14

Likert distribution: Q14
score n percent
1 6 10.2
2 7 11.9
3 17 28.8
4 19 32.2
5 10 16.9

#### Q15

Likert distribution: Q15
score n percent
1 7 11.9
2 6 10.2
3 17 28.8
4 15 25.4
5 14 23.7

#### Q16

Likert distribution: Q16
score n percent
1 4 6.8
2 3 5.1
3 15 25.4
4 18 30.5
5 19 32.2

#### Q17

Likert distribution: Q17
score n percent
1 4 6.8
2 1 1.7
3 17 28.8
4 21 35.6
5 16 27.1

#### Q18

Likert distribution: Q18
score n percent
1 4 6.8
2 4 6.8
3 12 20.3
4 20 33.9
5 19 32.2

#### Q19

Likert distribution: Q19
score n percent
1 4 6.8
2 1 1.7
3 14 23.7
4 20 33.9
5 20 33.9

#### Q20

Likert distribution: Q20
score n percent
1 4 6.8
2 4 6.8
3 11 18.6
4 16 27.1
5 24 40.7

Annotated finding: For RQ4, compare Q18 and Q19 to assess whether respondents value accurate order information and real-time tracking. Use Q14 and Q17 as supporting indicators of the current collection experience. A high agreement percentage represents respondent perception, not a measured reduction in errors or processing time.

2.4 4. Bivariate Analysis – RQ4-focused pairs

At least three pairs are examined below. The first two are directly related to the proposed order-coordination solution; the third checks whether perceptions of accurate order information and tracking move together. Q14 and Q17 are included as an additional supporting pair.

2.4.1 Pair 1: Q10 × Q9 – Delivery preference and preferred operational improvement

Why this pair? Q10 identifies the preferred fulfillment arrangement, while Q9 identifies the improvement respondents believe would reduce waiting time. Comparing them helps the group avoid recommending one delivery model without considering the operational improvement students prioritize. The cross-tabulation is descriptive; small cells may make a conventional chi-square test unreliable.

tab_q10_q9 <- raw |>
  filter(!is.na(q10), !is.na(q9)) |>
  count(q10, q9) |>
  group_by(q10) |>
  mutate(row_percent = 100 * n / sum(n)) |>
  ungroup()

knitr::kable(
  tab_q10_q9,
  digits = 1,
  caption = "Q10 by Q9: counts and within-Q10 percentages"
)
Q10 by Q9: counts and within-Q10 percentages
q10 q9 n row_percent
A. Pickup directly at the store (Tự đến cửa hàng nhận hàng) A. Increasing the number of staff (Tăng số lượng nhân viên) 5 26.3
A. Pickup directly at the store (Tự đến cửa hàng nhận hàng) B. Preparing ingredients in advance (Chuẩn bị nguyên liệu trước) 3 15.8
A. Pickup directly at the store (Tự đến cửa hàng nhận hàng) C. Improving the drink preparation workflow (Cải tiến quy trình pha chế) 6 31.6
A. Pickup directly at the store (Tự đến cửa hàng nhận hàng) D. Using a pre-order system (Áp dụng hệ thống đặt hàng trước) 3 15.8
A. Pickup directly at the store (Tự đến cửa hàng nhận hàng) E. Improving order allocation and queue management (Cải thiện việc phân bổ đơn hàng và quản lý hàng chờ) 2 10.5
B. Pickup at a designated campus collection point (Nhận tại điểm giao nhận tập trung trong trường) A. Increasing the number of staff (Tăng số lượng nhân viên) 1 11.1
B. Pickup at a designated campus collection point (Nhận tại điểm giao nhận tập trung trong trường) B. Preparing ingredients in advance (Chuẩn bị nguyên liệu trước) 3 33.3
B. Pickup at a designated campus collection point (Nhận tại điểm giao nhận tập trung trong trường) C. Improving the drink preparation workflow (Cải tiến quy trình pha chế) 2 22.2
B. Pickup at a designated campus collection point (Nhận tại điểm giao nhận tập trung trong trường) E. Improving order allocation and queue management (Cải thiện việc phân bổ đơn hàng và quản lý hàng chờ) 3 33.3
C. Delivery to a classroom or campus building (Giao đến lớp học hoặc tòa nhà trong trường) A. Increasing the number of staff (Tăng số lượng nhân viên) 5 22.7
C. Delivery to a classroom or campus building (Giao đến lớp học hoặc tòa nhà trong trường) B. Preparing ingredients in advance (Chuẩn bị nguyên liệu trước) 1 4.5
C. Delivery to a classroom or campus building (Giao đến lớp học hoặc tòa nhà trong trường) C. Improving the drink preparation workflow (Cải tiến quy trình pha chế) 6 27.3
C. Delivery to a classroom or campus building (Giao đến lớp học hoặc tòa nhà trong trường) D. Using a pre-order system (Áp dụng hệ thống đặt hàng trước) 5 22.7
C. Delivery to a classroom or campus building (Giao đến lớp học hoặc tòa nhà trong trường) E. Improving order allocation and queue management (Cải thiện việc phân bổ đơn hàng và quản lý hàng chờ) 5 22.7
D. Delivery by an independent rider (Giao qua tài xế độc lập) C. Improving the drink preparation workflow (Cải tiến quy trình pha chế) 1 100.0
E. Scheduled group delivery to campus (Gộp nhiều đơn để giao cùng một chuyến đến trường) A. Increasing the number of staff (Tăng số lượng nhân viên) 2 25.0
E. Scheduled group delivery to campus (Gộp nhiều đơn để giao cùng một chuyến đến trường) B. Preparing ingredients in advance (Chuẩn bị nguyên liệu trước) 1 12.5
E. Scheduled group delivery to campus (Gộp nhiều đơn để giao cùng một chuyến đến trường) D. Using a pre-order system (Áp dụng hệ thống đặt hàng trước) 2 25.0
E. Scheduled group delivery to campus (Gộp nhiều đơn để giao cùng một chuyến đến trường) E. Improving order allocation and queue management (Cải thiện việc phân bổ đơn hàng và quản lý hàng chờ) 3 37.5
ggplot(tab_q10_q9, aes(x = q10, y = row_percent, fill = q9)) +
  geom_col() +
  coord_flip() +
  scale_y_continuous(labels = scales::percent_format(scale = 1)) +
  labs(
    title = "Preferred improvement within each delivery preference",
    x = "Q10 – preferred arrangement",
    y = "Percentage within Q10",
    fill = "Q9 – preferred improvement"
  ) +
  theme_minimal()

Annotated finding: Identify whether different Q10 groups show different Q9 priorities. Use the result to decide whether one common workflow can serve all order types or whether the store needs separate pickup and campus-delivery lanes. Do not interpret this cross-tabulation as a causal effect.

2.4.2 Pair 2: Q10 × Q18 – Delivery preference and value of accurate order information

Why this pair? The store may handle pickup and delivery orders differently, but all channels need reliable order details. This comparison checks whether the perceived importance of accurate information varies across Q10 preference groups.

tab_q10_q18 <- raw |>
  filter(!is.na(q10), !is.na(q18)) |>
  count(q10, q18) |>
  group_by(q10) |>
  mutate(row_percent = 100 * n / sum(n)) |>
  ungroup()

knitr::kable(
  tab_q10_q18,
  digits = 1,
  caption = "Q10 by Q18: counts and within-Q10 percentages"
)
Q10 by Q18: counts and within-Q10 percentages
q10 q18 n row_percent
A. Pickup directly at the store (Tự đến cửa hàng nhận hàng) 1 3 15.8
A. Pickup directly at the store (Tự đến cửa hàng nhận hàng) 2 3 15.8
A. Pickup directly at the store (Tự đến cửa hàng nhận hàng) 3 2 10.5
A. Pickup directly at the store (Tự đến cửa hàng nhận hàng) 4 7 36.8
A. Pickup directly at the store (Tự đến cửa hàng nhận hàng) 5 4 21.1
B. Pickup at a designated campus collection point (Nhận tại điểm giao nhận tập trung trong trường) 3 4 44.4
B. Pickup at a designated campus collection point (Nhận tại điểm giao nhận tập trung trong trường) 4 2 22.2
B. Pickup at a designated campus collection point (Nhận tại điểm giao nhận tập trung trong trường) 5 3 33.3
C. Delivery to a classroom or campus building (Giao đến lớp học hoặc tòa nhà trong trường) 1 1 4.5
C. Delivery to a classroom or campus building (Giao đến lớp học hoặc tòa nhà trong trường) 2 1 4.5
C. Delivery to a classroom or campus building (Giao đến lớp học hoặc tòa nhà trong trường) 3 4 18.2
C. Delivery to a classroom or campus building (Giao đến lớp học hoặc tòa nhà trong trường) 4 8 36.4
C. Delivery to a classroom or campus building (Giao đến lớp học hoặc tòa nhà trong trường) 5 8 36.4
D. Delivery by an independent rider (Giao qua tài xế độc lập) 5 1 100.0
E. Scheduled group delivery to campus (Gộp nhiều đơn để giao cùng một chuyến đến trường) 3 2 25.0
E. Scheduled group delivery to campus (Gộp nhiều đơn để giao cùng một chuyến đến trường) 4 3 37.5
E. Scheduled group delivery to campus (Gộp nhiều đơn để giao cùng một chuyến đến trường) 5 3 37.5
ggplot(tab_q10_q18, aes(x = q10, y = row_percent, fill = factor(q18))) +
  geom_col() +
  coord_flip() +
  scale_y_continuous(labels = scales::percent_format(scale = 1)) +
  labs(
    title = "Q18 ratings within each Q10 preference group",
    x = "Q10 – preferred arrangement",
    y = "Percentage within Q10",
    fill = "Q18 rating"
  ) +
  theme_minimal()

Annotated finding: If ratings of 4–5 are common across Q10 groups, accurate order information is a cross-channel requirement rather than a feature for only one delivery method. Because the sample is small and some Q10 categories may be rare, focus on the displayed counts and percentages; avoid overclaiming statistical differences.

2.4.3 Pair 3: Q18 × Q19 – Accurate order information and real-time tracking

Why this pair? Q18 and Q19 represent two connected components of centralized order management: accurate order details and visibility of order status. Spearman correlation is suitable for checking whether higher ordinal ratings tend to occur together.


``` r
# Prepare Q18 and Q19
pair_q18_q19 <- raw |>
  dplyr::select(q18, q19) |>
  dplyr::mutate(
    q18 = as.numeric(as.character(q18)),
    q19 = as.numeric(as.character(q19))
  ) |>
  tidyr::drop_na()

# Spearman correlation
if (
  nrow(pair_q18_q19) >= 3 &&
  dplyr::n_distinct(pair_q18_q19$q18) > 1 &&
  dplyr::n_distinct(pair_q18_q19$q19) > 1
) {
  cor_q18_q19 <- cor.test(
    pair_q18_q19$q18,
    pair_q18_q19$q19,
    method = "spearman",
    exact = FALSE
  )

  print(cor_q18_q19)
} else {
  cat("Not enough complete or varied responses to calculate Spearman correlation.")
}
## 
##  Spearman's rank correlation rho
## 
## data:  pair_q18_q19$q18 and pair_q18_q19$q19
## S = 10548, p-value = 1.305e-09
## alternative hypothesis: true rho is not equal to 0
## sample estimates:
##       rho 
## 0.6917551
# Heatmap
heatmap_data <- pair_q18_q19 |>
  dplyr::count(q18, q19)

ggplot2::ggplot(
  heatmap_data,
  ggplot2::aes(
    x = factor(q18, levels = 1:5),
    y = factor(q19, levels = 1:5),
    fill = n
  )
) +
  ggplot2::geom_tile(color = "white") +
  ggplot2::geom_text(ggplot2::aes(label = n), size = 4) +
  ggplot2::scale_fill_gradient(
    low = "lightblue",
    high = "steelblue",
    name = "Respondents"
  ) +
  ggplot2::labs(
    title = "Relationship between Q18 and Q19",
    x = "Q18 – accurate order information",
    y = "Q19 – real-time order tracking"
  ) +
  ggplot2::theme_classic() +
  ggplot2::theme(
    legend.position = "none"
  )

Annotated finding: A positive Spearman association would indicate that respondents who value accurate order information also tend to value real-time tracking. This supports considering both functions together in a centralized order queue; it does not prove that installing a tracking system will reduce workload.

2.4.4 Additional supporting pair: Q14 × Q17 – Readiness identification and collection convenience

Why this pair? Q14 measures whether students can identify when a drink is ready, while Q17 measures perceived convenience and lack of confusion in the collection process. This pair checks whether readiness visibility is related to the overall collection experience.


``` r
# Prepare Q14 and Q17
pair_q14_q17 <- raw |>
  dplyr::select(q14, q17) |>
  dplyr::mutate(
    q14 = as.numeric(as.character(q14)),
    q17 = as.numeric(as.character(q17))
  ) |>
  tidyr::drop_na()

# Spearman correlation
if (
  nrow(pair_q14_q17) >= 3 &&
  dplyr::n_distinct(pair_q14_q17$q14) > 1 &&
  dplyr::n_distinct(pair_q14_q17$q17) > 1
) {
  cor_q14_q17 <- cor.test(
    pair_q14_q17$q14,
    pair_q14_q17$q17,
    method = "spearman",
    exact = FALSE
  )

  print(cor_q14_q17)
} else {
  cat("Not enough complete or varied responses to calculate Spearman correlation.")
}
## 
##  Spearman's rank correlation rho
## 
## data:  pair_q14_q17$q14 and pair_q14_q17$q17
## S = 17103, p-value = 5.483e-05
## alternative hypothesis: true rho is not equal to 0
## sample estimates:
##       rho 
## 0.5002019
# Prepare heatmap data
heatmap_q14_q17 <- pair_q14_q17 |>
  dplyr::count(q14, q17)

# Draw heatmap
ggplot2::ggplot(
  heatmap_q14_q17,
  ggplot2::aes(
    x = factor(q14, levels = 1:5),
    y = factor(q17, levels = 1:5),
    fill = n
  )
) +
  ggplot2::geom_tile(color = "white") +
  ggplot2::geom_text(ggplot2::aes(label = n), size = 4) +
  ggplot2::scale_fill_gradient(
    low = "lightblue",
    high = "steelblue",
    guide = "none"
  ) +
  ggplot2::labs(
    title = "Relationship between Q14 and Q17",
    x = "Q14 – identify when the drink is ready",
    y = "Q17 – collection convenience"
  ) +
  ggplot2::theme_classic()

Annotated finding: If higher Q14 ratings tend to accompany higher Q17 ratings, clearer ready-status communication may be a useful part of the collection redesign. Treat this as an association in student ratings, not proof of a causal mechanism.

3 Key Insights and Data Problems – preliminary EDA notes

Use the knitted outputs to finalize 3–5 insights. The raw-file audit should be used to confirm the missing-value counts for every question and the number of completely duplicated rows. Do not silently delete a respondent with a missing answer. Q4 is not one of the core RQ4 variables, so a pairwise analysis can retain a respondent where the variables required for that analysis are present.

4 RQ4 – data-led operational recommendations

The survey can support the following proposed operating design, to be tested rather than claimed as proven:

  1. Centralized order queue: Enter every order channel into one shared order list with a unique order ID, customer name or pickup identifier, item, channel, destination, order time and promised handover time.

  2. Two fulfillment lanes: (a) direct store pickup and (b) campus delivery to a classroom. The Q10 results should be used to assess the importance of each option. Treat a designated pickup point or scheduled group delivery as a pilot option, not the default, unless the survey results support it.

  3. Four-person role allocation: Person 1 validates orders and maintains the queue; Person 2 prepares ingredients and replenishes stations; Person 3 prepares drinks in queue order; Person 4 performs quality checks, packs, updates status and hands over. During peaks, rebalance roles based on the actual bottleneck rather than keeping rigid assignments.

  4. Order status control: Received → Confirmed → Preparing → Ready for pickup → Delivered. Use order IDs and clear pickup labels to reduce repeated questions and handover confusion.

  5. Peak-period preparation: Prepare high-use ingredients in advance only to a safe, forecast-based level; monitor waste and stockouts. This is a supporting process change, not something Q10/Q18/Q19 directly measure.

Important limitation: The survey does not contain actual staff counts by shift, order arrivals per hour, service times, travel times, error rates, or workload by employee. Therefore, it cannot establish that four employees can process a particular volume or quantify workload reduction. To validate the design, run a pilot and record hour, average order lead time, queue time, handover time, order error rate, delivery time, and workload by role before and after implementation.

5 Reproducibility note

This is Step 1 EDA on the raw main dataset. Keep the raw CSV unchanged. Step 2 must document missing values, duplicates, impossible values and other data problems, justify each cleaning decision, report the number of records affected, and save a new cleaned dataset. The assignment requires the final EDA notebook as .Rmd and knitted .html with collapsible code chunks.