setwd("D:/MBA/MKT 6000/")
library(readxl)
Data <- segmentation_analysis_1_ <- read_excel("segmentation_analysis (1).xlsx")
View(Data)
clusterdata <- Data[, -1]
head(clusterdata)
## # A tibble: 6 × 2
## NASCAR NCAA_College_Football
## <dbl> <dbl>
## 1 6 1
## 2 5 4
## 3 3 4
## 4 2 6
## 5 3 9
## 6 5 1
clustering <- kmeans(x = clusterdata, 2)
clusterdata$cluster <- as.character(clustering$cluster)
head(clusterdata)
## # A tibble: 6 × 3
## NASCAR NCAA_College_Football cluster
## <dbl> <dbl> <chr>
## 1 6 1 1
## 2 5 4 1
## 3 3 4 2
## 4 2 6 2
## 5 3 9 2
## 6 5 1 1
library(ggplot2)
ggplot() +
geom_point(data = clusterdata,
mapping = aes(x = NASCAR,
y = NCAA_College_Football,
colour = cluster))
