library(readxl)
library(ggplot2)
library(dplyr)
Fokus analisis adalah: Hubungan Sales vs Profit: Melihat korelasi antara volume penjualan dan keuntungan. Performa Market: Membandingkan total penjualan di tiap wilayah (Region).
coffee <- read_excel("C:/Users/m s i/Documents/SIM 2/1. Tugas SIM 2025B - Coffee Chain Datasets.xlsx")
glimpse(coffee)
## Rows: 4,248
## Columns: 20
## $ `Area Code` <dbl> 719, 970, 970, 303, 303, 720, 970, 719, 970, 719, 303…
## $ Date <dttm> 2012-01-01, 2012-01-01, 2012-01-01, 2012-01-01, 2012…
## $ Market <chr> "Central", "Central", "Central", "Central", "Central"…
## $ `Market Size` <chr> "Major Market", "Major Market", "Major Market", "Majo…
## $ Product <chr> "Amaretto", "Colombian", "Decaf Irish Cream", "Green …
## $ `Product Line` <chr> "Beans", "Beans", "Beans", "Leaves", "Beans", "Beans"…
## $ `Product Type` <chr> "Coffee", "Coffee", "Coffee", "Tea", "Espresso", "Esp…
## $ State <chr> "Colorado", "Colorado", "Colorado", "Colorado", "Colo…
## $ Type <chr> "Regular", "Regular", "Decaf", "Regular", "Regular", …
## $ `Budget COGS` <dbl> 90, 80, 100, 30, 60, 80, 140, 50, 50, 40, 50, 150, 10…
## $ `Budget Margin` <dbl> 130, 110, 140, 50, 90, 130, 160, 80, 70, 70, 70, 210,…
## $ `Budget Profit` <dbl> 100, 80, 110, 30, 70, 80, 110, 20, 40, 20, 40, 130, 1…
## $ `Budget Sales` <dbl> 220, 190, 240, 80, 150, 210, 300, 130, 120, 110, 120,…
## $ COGS <dbl> 89, 83, 95, 44, 54, 72, 170, 63, 60, 58, 64, 144, 95,…
## $ Inventory <dbl> 777, 623, 821, 623, 456, 558, 1091, 435, 336, 338, 96…
## $ Margin <dbl> 130, 107, 139, 56, 80, 108, 171, 87, 80, 72, 76, 201,…
## $ Marketing <dbl> 24, 27, 26, 14, 15, 23, 47, 57, 19, 22, 19, 47, 30, 7…
## $ Profit <dbl> 94, 68, 101, 30, 54, 53, 99, 0, 33, 17, 36, 111, 87, …
## $ Sales <dbl> 219, 190, 234, 100, 134, 180, 341, 150, 140, 130, 140…
## $ `Total Expenses` <dbl> 36, 39, 38, 26, 26, 55, 72, 87, 47, 55, 40, 90, 52, 1…
summary(coffee)
## Area Code Date Market
## Min. :203.0 Min. :2012-01-01 00:00:00 Length:4248
## 1st Qu.:417.0 1st Qu.:2012-06-23 12:00:00 Class :character
## Median :573.0 Median :2012-12-16 12:00:00 Mode :character
## Mean :582.3 Mean :2012-12-15 22:00:00
## 3rd Qu.:772.0 3rd Qu.:2013-06-08 12:00:00
## Max. :985.0 Max. :2013-12-01 00:00:00
## Market Size Product Product Line Product Type
## Length:4248 Length:4248 Length:4248 Length:4248
## Class :character Class :character Class :character Class :character
## Mode :character Mode :character Mode :character Mode :character
##
##
##
## State Type Budget COGS Budget Margin
## Length:4248 Length:4248 Min. : 0.00 Min. :-210.0
## Class :character Class :character 1st Qu.: 30.00 1st Qu.: 50.0
## Mode :character Mode :character Median : 50.00 Median : 70.0
## Mean : 74.83 Mean : 100.8
## 3rd Qu.: 90.00 3rd Qu.: 130.0
## Max. :450.00 Max. : 690.0
## Budget Profit Budget Sales COGS Inventory
## Min. :-320.00 Min. : 0.0 Min. : 0.00 Min. :-3534.0
## 1st Qu.: 20.00 1st Qu.: 80.0 1st Qu.: 43.00 1st Qu.: 432.0
## Median : 40.00 Median : 130.0 Median : 60.00 Median : 619.0
## Mean : 60.91 Mean : 175.6 Mean : 84.43 Mean : 749.4
## 3rd Qu.: 80.00 3rd Qu.: 210.0 3rd Qu.:100.00 3rd Qu.: 910.5
## Max. : 560.00 Max. :1140.0 Max. :364.00 Max. : 8252.0
## Margin Marketing Profit Sales
## Min. :-302.00 Min. : 0.00 Min. :-638.0 Min. : 17
## 1st Qu.: 52.75 1st Qu.: 13.00 1st Qu.: 17.0 1st Qu.:100
## Median : 76.00 Median : 22.00 Median : 40.0 Median :138
## Mean : 104.29 Mean : 31.19 Mean : 61.1 Mean :193
## 3rd Qu.: 132.00 3rd Qu.: 39.00 3rd Qu.: 92.0 3rd Qu.:230
## Max. : 613.00 Max. :156.00 Max. : 778.0 Max. :912
## Total Expenses
## Min. : 10.00
## 1st Qu.: 33.00
## Median : 46.00
## Mean : 54.06
## 3rd Qu.: 65.00
## Max. :190.00
#Analisis Hubungan Sales dan Profit (Korelasi)
#Bagian ini menganalisis apakah setiap kenaikan penjualan berkontribusi langsung pada kenaikan laba.
ggplot(coffee, aes(x = Sales, y = Profit)) +
geom_point(alpha = 0.5, color = "steelblue") +
geom_smooth(method = "lm", color = "red", se = TRUE) +
labs(title = "Scatter Plot: Hubungan Sales vs Profit",
x = "Total Sales ($)", y = "Total Profit ($)") +
theme_minimal()
#Perbandingan Performa Penjualan per Region
#Analisis ini membandingkan kontribusi penjualan dari empat wilayah utama.
# Agregasi data penjualan per wilayah
market_summary <- coffee %>%
group_by(Market) %>%
summarise(Total_Sales = sum(Sales)) %>%
arrange(desc(Total_Sales))
# Visualisasi Bar Chart
ggplot(market_summary, aes(x = reorder(Market, -Total_Sales), y = Total_Sales, fill = Market)) +
geom_bar(stat = "identity", show.legend = FALSE) +
geom_text(aes(label = scales::comma(Total_Sales)), vjust = -0.5) +
labs(title = "Total Penjualan per Region",
x = "Region (Market)", y = "Total Sales ($)") +
theme_classic()
Interpretasi: Wilayah West dan Central adalah pemimpin pasar dengan
total penjualan tertinggi. Sebaliknya, wilayah South memiliki performa
terendah, yang mengindikasikan perlunya evaluasi strategi pemasaran di
wilayah tersebut.
Berdasarkan analisis di atas, Coffee Chain memiliki fundamental bisnis yang sehat karena profit tumbuh seiring dengan penjualan. Namun, manajemen perlu fokus pada pemerataan pasar, terutama di wilayah South, untuk memaksimalkan potensi pendapatan secara nasional.