r Sys.Date()```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) library(tidyverse) library(janitor) library(devtools) install_github(“vqv/ggbiplot”) library(ggbiplot) survey_raw <- read.csv(“MKTG 4000 - Group 2 Survey_April 15, 2026_16.21.csv”, stringsAsFactors = FALSE)
survey <- survey_raw[-c(1,2), ] %>% clean_names() %>% rename( academic_status = q1, textbook_format = q2, user_friendly = q3, purchase_pref = q4, other = q5, spending = q6, price_perception = q7 ) %>% mutate( academic_status = recode(academic_status, “Sophmore” = “Sophomore”), across(everything(), ~str_trim(.)) )
perception_data <- survey %>% mutate( pearson_user = ifelse(user_friendly == “Pearson”, 1, 0), mcgraw_user = ifelse(user_friendly == “McGraw Hill”, 1, 0), pearson_pref = ifelse(purchase_pref == “Pearson”, 1, 0), mcgraw_pref = ifelse(purchase_pref == “McGraw Hill”, 1, 0), pearson_expensive = ifelse(price_perception == “Pearson”, 1, 0), mcgraw_expensive = ifelse(price_perception == “McGraw Hill”, 1, 0) )
brand_data <- data.frame( Pearson = c( mean(perception_data\(pearson_user), mean(perception_data\)pearson_pref), mean(perception_data\(pearson_expensive) ), McGrawHill = c( mean(perception_data\)mcgraw_user), mean(perception_data\(mcgraw_pref), mean(perception_data\)mcgraw_expensive) ) )
rownames(brand_data) <- c(“UserFriendly”, “Preference”, “Expensive”)
brand_data
data.pca <- prcomp(t(brand_data), scale. = TRUE)
ggbiplot(data.pca, labels = rownames(t(brand_data)), obs.scale = 1, var.scale = 1, circle = TRUE) + ggtitle(“Perceptual Map: Pearson vs McGraw Hill”) + theme_minimal()
upperclass <- perception_data %>% filter(academic_status %in% c(“Junior”, “Senior”))
lowerclass <- perception_data %>% filter(academic_status %in% c(“Freshman”, “Sophomore”))
upper_brand <- data.frame( Pearson = c( mean(upperclass\(pearson_user), mean(upperclass\)pearson_pref), mean(upperclass\(pearson_expensive) ), McGrawHill = c( mean(upperclass\)mcgraw_user), mean(upperclass\(mcgraw_pref), mean(upperclass\)mcgraw_expensive) ) )
rownames(upper_brand) <- c(“UserFriendly”, “Preference”, “Expensive”)
pca_upper <- prcomp(t(upper_brand), scale. = TRUE)
ggbiplot(pca_upper, labels = rownames(t(upper_brand)), circle = TRUE) + ggtitle(“Perceptual Map: Upperclass Students”) + theme_minimal()
lower_brand <- data.frame( Pearson = c( mean(lowerclass\(pearson_user), mean(lowerclass\)pearson_pref), mean(lowerclass\(pearson_expensive) ), McGrawHill = c( mean(lowerclass\)mcgraw_user), mean(lowerclass\(mcgraw_pref), mean(lowerclass\)mcgraw_expensive) ) )
rownames(lower_brand) <- c(“UserFriendly”, “Preference”, “Expensive”)
pca_lower <- prcomp(t(lower_brand), scale. = TRUE)
ggbiplot(pca_lower, labels = rownames(t(lower_brand)), circle = TRUE) + ggtitle(“Perceptual Map: Lowerclass Students”) + theme_minimal()