# ✅ SAFEST WAY TO LOAD YOUR CSV FILE
# 1️⃣ Load readr (part of tidyverse)
library(readr)
# 2️⃣ Define the FULL ABSOLUTE PATH to your file
csv_path <- "C:/Users/Lenovo/Downloads/thesis/survey analysis/Survey_clean.csv"
# 3️⃣ Check if the file really exists
file.exists(csv_path)
## [1] TRUE
# 4️⃣ Read the CSV only if the file exists
if (file.exists(csv_path)) {
survey <- read_csv(csv_path)
message("✅ CSV loaded successfully!")
# Preview structure and first rows
str(survey)
head(survey, 10)
} else {
stop("❌ File not found! Check the path or filename.")
}
## Rows: 97 Columns: 21
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (12): dining_frequency, age_group, dining_companions, avg_spend_per_meal...
## dbl (9): person, comfort_info_apps, comfort_communication_apps, comfort_ord...
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
## ✅ CSV loaded successfully!
## spc_tbl_ [97 × 21] (S3: spec_tbl_df/tbl_df/tbl/data.frame)
## $ person : num [1:97] 1 2 3 4 5 6 7 8 9 10 ...
## $ dining_frequency : chr [1:97] "Several times per week" "Several times per week" "Several times per month" "Several times per month" ...
## $ age_group : chr [1:97] "25-34" "25-34" "25-34" "18-24" ...
## $ dining_companions : chr [1:97] "Alone;With one friend or partner;With several friends;With family;With colleagues" "Alone;With one friend or partner;With several friends;With family;With colleagues" "With one friend or partner;With several friends;With family;With colleagues" "With one friend or partner;With several friends;With family" ...
## $ avg_spend_per_meal : chr [1:97] "Less than €10" "€10 - €20" "€10 - €20" "€21 - €30" ...
## $ dining_types : chr [1:97] "Fast food restaurants;Casual dining restaurants;Cafés or coffee shops;Takeaway or food stands" "Casual dining restaurants;Cafés or coffee shops;Takeaway or food stands" "Fast food restaurants;Casual dining restaurants;Cafés or coffee shops" "Casual dining restaurants;Cafés or coffee shops;Fine dining establishments" ...
## $ comfort_info_apps : num [1:97] 3 5 4 4 5 5 5 4 3 5 ...
## $ comfort_communication_apps: num [1:97] 3 5 4 4 5 5 5 5 3 5 ...
## $ comfort_ordering_apps : num [1:97] 3 5 5 4 4 3 3 5 3 5 ...
## $ comfort_payment_apps : num [1:97] 3 4 5 3 4 4 5 5 2 2 ...
## $ comfort_entertainment_apps: num [1:97] 4 5 5 3 5 5 5 4 4 5 ...
## $ used_digital_ordering : chr [1:97] "Yes" "Yes" "Yes" "Yes" ...
## $ rating_digital_experience : num [1:97] 4 5 4 4 4 NA 5 4 4 5 ...
## $ benefits_digital_ordering : chr [1:97] "Shorter waiting time;Easier payment process;Less interaction needed with staff;Better overview of the menu;Order accuracy" "Shorter waiting time;Easier payment process;Better overview of the menu" "Shorter waiting time;Easier payment process;Better overview of the menu" "Shorter waiting time;Easier payment process;Less interaction needed with staff;Better overview of the menu" ...
## $ problems_digital_ordering : chr [1:97] "No" "I could ask the waiter in person about the food, it didn't have some kind of chat bot for questions" "No" "No" ...
## $ usefulness_unified_app : num [1:97] 4 5 5 5 5 4 5 5 4 4 ...
## $ importance_unified_app : num [1:97] 2 3 3 4 4 4 5 3 2 4 ...
## $ more_likely_dine_out : chr [1:97] "No" "Maybe" "Yes" "Yes" ...
## $ concerns_unified_app : chr [1:97] "Data privacy;Technical problems;Less interaction with staff;Too complicated to use" "No concerns" "Data privacy;Technical problems;Too complicated to use" "Data privacy;Technical problems;Less interaction with staff;Too complicated to use" ...
## $ willingness_unified_app : chr [1:97] "Maybe" "Yes" "Yes" "Maybe" ...
## $ additional_comments : chr [1:97] "It's data needs to be extremely well-encrypted" "Hav e a chatbot" NA NA ...
## - attr(*, "spec")=
## .. cols(
## .. person = col_double(),
## .. dining_frequency = col_character(),
## .. age_group = col_character(),
## .. dining_companions = col_character(),
## .. avg_spend_per_meal = col_character(),
## .. dining_types = col_character(),
## .. comfort_info_apps = col_double(),
## .. comfort_communication_apps = col_double(),
## .. comfort_ordering_apps = col_double(),
## .. comfort_payment_apps = col_double(),
## .. comfort_entertainment_apps = col_double(),
## .. used_digital_ordering = col_character(),
## .. rating_digital_experience = col_double(),
## .. benefits_digital_ordering = col_character(),
## .. problems_digital_ordering = col_character(),
## .. usefulness_unified_app = col_double(),
## .. importance_unified_app = col_double(),
## .. more_likely_dine_out = col_character(),
## .. concerns_unified_app = col_character(),
## .. willingness_unified_app = col_character(),
## .. additional_comments = col_character()
## .. )
## - attr(*, "problems")=<externalptr>
## # A tibble: 10 × 21
## person dining_frequency age_group dining_companions avg_spend_per_meal
## <dbl> <chr> <chr> <chr> <chr>
## 1 1 Several times per week 25-34 Alone;With one f… Less than €10
## 2 2 Several times per week 25-34 Alone;With one f… €10 - €20
## 3 3 Several times per month 25-34 With one friend … €10 - €20
## 4 4 Several times per month 18-24 With one friend … €21 - €30
## 5 5 Once per week 18-24 With one friend … €10 - €20
## 6 6 Several times per month 25-34 With several fri… €10 - €20
## 7 7 Several times per week 25-34 With one friend … €10 - €20
## 8 8 Once per month 25-34 With one friend … Less than €10
## 9 9 Several times per week 25-34 Alone;With one f… Less than €10
## 10 10 Several times per week 25-34 With one friend … Less than €10
## # ℹ 16 more variables: dining_types <chr>, comfort_info_apps <dbl>,
## # comfort_communication_apps <dbl>, comfort_ordering_apps <dbl>,
## # comfort_payment_apps <dbl>, comfort_entertainment_apps <dbl>,
## # used_digital_ordering <chr>, rating_digital_experience <dbl>,
## # benefits_digital_ordering <chr>, problems_digital_ordering <chr>,
## # usefulness_unified_app <dbl>, importance_unified_app <dbl>,
## # more_likely_dine_out <chr>, concerns_unified_app <chr>, …
library(ggplot2)
library(dplyr)
library(ggplot2)
library(dplyr)
# ✅ Reorder so "Under 18" is FIRST
survey <- survey %>%
mutate(
age_group = factor(age_group,
levels = c("Under 18", "18-24", "25-34", "35-44", "45-54", "55+"),
ordered = TRUE),
dining_frequency = factor(dining_frequency,
levels = c("Rarely", "Once per month",
"Several times per month",
"Once per week",
"Several times per week"),
ordered = TRUE)
)
# ✅ Plot with Under 18 first
ggplot(survey, aes(x = age_group, fill = dining_frequency)) +
geom_bar(position = "fill") +
scale_y_continuous(labels = scales::percent) +
scale_fill_brewer(palette = "Pastel1") +
labs(
title = "Dining Frequency by Age Group",
x = "Age Group",
y = "Percentage",
fill = "Dining Frequency"
) +
theme_minimal() +
theme(axis.text.x = element_text(angle = 30, hjust = 1))

# Convert comfort_payment_apps to an ordered factor
survey$comfort_payment_apps <- factor(
survey$comfort_payment_apps,
levels = c("1", "2", "3", "4", "5"),
labels = c("Very Uncomfortable", "Uncomfortable", "Neutral", "Comfortable", "Very Comfortable"),
ordered = TRUE
)
library(ggplot2)
ggplot(survey, aes(x = age_group, fill = comfort_payment_apps)) +
geom_bar(position = "fill") + # Percentage bars
scale_y_continuous(labels = scales::percent) +
scale_fill_brewer(palette = "Pastel1") + # Soft minimalistic colors
labs(
title = "Comfort with Payment Apps by Age Group",
x = "Age Group",
y = "Percentage",
fill = "Comfort Level"
) +
theme_minimal() +
theme(axis.text.x = element_text(angle = 30, hjust = 1),
legend.position = "right")

survey$willingness_unified_app <- factor(
survey$willingness_unified_app,
levels = c("No", "Maybe", "Yes") # Logical order
)
library(ggplot2)
ggplot(survey, aes(x = dining_frequency, fill = willingness_unified_app)) +
geom_bar(position = "fill") + # Fill makes it show percentages
scale_y_continuous(labels = scales::percent) +
scale_fill_brewer(palette = "Pastel1") + # Minimalistic soft colors
labs(
title = "Willingness to Use a Universal App by Dining Frequency",
x = "Dining Frequency",
y = "Percentage",
fill = "Willingness"
) +
theme_minimal() +
theme(axis.text.x = element_text(angle = 30, hjust = 1),
legend.position = "right")

# Comfort levels ordered logically
survey$comfort_payment_apps <- factor(
survey$comfort_payment_apps,
levels = c("Very Uncomfortable", "Uncomfortable", "Neutral", "Comfortable", "Very Comfortable")
)
# Previous digital ordering experience
survey$used_digital_ordering <- factor(
survey$used_digital_ordering,
levels = c("No", "Yes") # No first, Yes second
)
library(ggplot2)
ggplot(survey, aes(x = used_digital_ordering, fill = comfort_payment_apps)) +
geom_bar(position = "fill") + # show percentage stacks
scale_y_continuous(labels = scales::percent) +
scale_fill_brewer(palette = "Pastel1") + # soft minimal colors
labs(
title = "Comfort with Payment Apps vs Previous Digital Ordering Experience",
x = "Previously Used Digital Ordering",
y = "Percentage",
fill = "Comfort Level"
) +
theme_minimal() +
theme(axis.text.x = element_text(angle = 0, hjust = 0.5),
legend.position = "right")

ggplot(survey, aes(x = age_group, fill = willingness_unified_app)) +
geom_bar(position = "fill") +
scale_y_continuous(labels = scales::percent) +
scale_fill_brewer(palette = "Pastel2") +
labs(
title = "Willingness to Use Universal App by Age Group",
x = "Age Group",
y = "Percentage",
fill = "Willingness"
) +
theme_minimal() +
theme(axis.text.x = element_text(angle = 30, hjust = 1))

ggplot(survey, aes(x = dining_frequency, fill = used_digital_ordering)) +
geom_bar(position = "fill") +
scale_y_continuous(labels = scales::percent) +
scale_fill_brewer(palette = "Pastel1") +
labs(
title = "Previous Digital Ordering Experience by Dining Frequency",
x = "Dining Frequency",
y = "Percentage",
fill = "Used Digital Ordering?"
) +
theme_minimal() +
theme(axis.text.x = element_text(angle = 30, hjust = 1))

ggplot(survey, aes(x = age_group, fill = used_digital_ordering)) +
geom_bar(position = "fill") +
scale_y_continuous(labels = scales::percent) +
scale_fill_brewer(palette = "Pastel2") +
labs(
title = "Previous Digital Ordering Experience by Age Group",
x = "Age Group",
y = "Percentage",
fill = "Used Digital Ordering?"
) +
theme_minimal() +
theme(axis.text.x = element_text(angle = 30, hjust = 1))
