library(readxl)
data_uts <- read_excel(
"C:/Users/acer/OneDrive/Dokumen/bakery_synthetic_dataset.xlsx",
col_names = TRUE
)
data_uts
summary(data_uts)
## Date Customer_Age Product
## Min. :2023-01-01 00:00:00.00 Min. :16.00 Length:16569
## 1st Qu.:2023-07-06 00:00:00.00 1st Qu.:23.00 Class :character
## Median :2024-01-05 00:00:00.00 Median :30.00 Mode :character
## Mean :2024-01-04 00:36:45.75 Mean :34.48
## 3rd Qu.:2024-07-06 00:00:00.00 3rd Qu.:44.00
## Max. :2024-12-31 00:00:00.00 Max. :74.00
## Category Quantity Unit_Price Discount_Percentage
## Length:16569 Min. :1.000 Min. : 24.25 Min. : 0.000
## Class :character 1st Qu.:2.000 1st Qu.: 39.54 1st Qu.: 0.000
## Mode :character Median :2.000 Median : 50.81 Median : 3.800
## Mean :2.591 Mean : 85.69 Mean : 6.656
## 3rd Qu.:3.000 3rd Qu.: 71.91 3rd Qu.:10.200
## Max. :6.000 Max. :463.49 Max. :30.000
## Selling_Price Total_Bill Payment_Method Stock_Available
## Min. : 17.17 Min. : 17.61 Length:16569 Min. : 1.000
## 1st Qu.: 36.50 1st Qu.: 74.34 Class :character 1st Qu.: 2.000
## Median : 48.24 Median : 119.96 Mode :character Median : 2.000
## Mean : 79.96 Mean : 207.86 Mean : 2.748
## 3rd Qu.: 70.55 3rd Qu.: 209.11 3rd Qu.: 3.000
## Max. :463.30 Max. :2758.98 Max. :21.000
## Units_Produced Units_Sold Profit
## Min. : 2.000 Min. : 1.0 Min. :-2152.66
## 1st Qu.: 5.000 1st Qu.: 2.0 1st Qu.: -34.12
## Median : 7.000 Median : 4.0 Median : -0.42
## Mean : 7.647 Mean : 4.9 Mean : -13.90
## 3rd Qu.:10.000 3rd Qu.: 6.0 3rd Qu.: 25.14
## Max. :39.000 Max. :25.0 Max. : 898.42
modus_Product <- names(which.max(table(data_uts$Product)))
paste("Modus data kolom Product :",modus_Product)
## [1] "Modus data kolom Product : Bread"
sedikit_Product <- names(which.min(table(data_uts$Product)))
paste("Product paling sedikit :", sedikit_Product)
## [1] "Product paling sedikit : Honey"
modus_Category <- names(which.max(table(data_uts$Category)))
paste("Modus data kolom Category :",modus_Category)
## [1] "Modus data kolom Category : Beverages"
sedikit_Category <- names(which.min(table(data_uts$Category)))
paste("Category paling sedikit :", sedikit_Category)
## [1] "Category paling sedikit : Muffins"
modus_Payment_Method <- names(which.max(table(data_uts$Payment_Method)))
paste("Modus data kolom Payment Method :",modus_Payment_Method)
## [1] "Modus data kolom Payment Method : UPI"
sedikit_Payment_Method <- names(which.min(table(data_uts$Payment_Method)))
paste("Payment Method paling sedikit :", sedikit_Payment_Method)
## [1] "Payment Method paling sedikit : Wallet"
sd_CustomerAge <- sd(data_uts$Customer_Age, na.rm = TRUE)
paste("Standar Deviasi data kolom Customer Age :",sd_CustomerAge)
## [1] "Standar Deviasi data kolom Customer Age : 15.2989973121483"
sd_Quantity <- sd(data_uts$Quantity, na.rm = TRUE)
paste("Standar Deviasi kolom Quantity :",sd_Quantity)
## [1] "Standar Deviasi kolom Quantity : 1.25165709836292"
sd_Unit_Price <- sd(data_uts$Unit_Price, na.rm = TRUE)
paste("Standar Deviasi kolom Unit Price :",sd_Unit_Price)
## [1] "Standar Deviasi kolom Unit Price : 96.9511935374476"
sd_DiscountPercentage <- sd(data_uts$Discount_Percentage, na.rm = TRUE)
paste("Standar Deviasi kolom Discount Percentage :",sd_DiscountPercentage)
## [1] "Standar Deviasi kolom Discount Percentage : 8.00023423563348"
sd_Selling_Price <- sd(data_uts$Selling_Price, na.rm = TRUE)
paste("Standar Deviasi kolom Selling Price :",sd_Selling_Price)
## [1] "Standar Deviasi kolom Selling Price : 91.0461599408723"
sd_Total_Bill <- sd(data_uts$Total_Bill, na.rm = TRUE)
paste("Standar Deviasi kolom Total Bill :",sd_Total_Bill)
## [1] "Standar Deviasi kolom Total Bill : 281.230169963612"
sd_Stock_Available <- sd(data_uts$Stock_Available, na.rm = TRUE)
paste("Standar Deviasi kolom stock Available :",sd_Stock_Available)
## [1] "Standar Deviasi kolom stock Available : 1.9003413356256"
sd_Units_Produced <- sd(data_uts$Units_Produced, na.rm = TRUE)
paste("Standar Deviasi kolom Units Produced :",sd_Units_Produced)
## [1] "Standar Deviasi kolom Units Produced : 4.43546590326741"
sd_Units_Sold <- sd(data_uts$Units_Sold, na.rm = TRUE)
paste("Standar Deviasi kolom Units Sold :",sd_Units_Sold)
## [1] "Standar Deviasi kolom Units Sold : 3.33244234115362"
sd_Profit <- sd(data_uts$Profit, na.rm = TRUE)
paste("Standar Deviasi kolom Profit :",sd_Profit)
## [1] "Standar Deviasi kolom Profit : 109.335028153946"
ringkasan_stat_deskriptif_quanti <- data.frame(
Variabel = c("Date","Costumer_Age","Quantity","Unit_Price","Discount_Percentage","Selling_Price","Total_Bill","Stock_Available","Units_Produced","Units_Sold","Profit"),
Min = c("2023-01-01 00:00:00",16.00,1.000,24.25,0.000,17.17,17.61,1.000,2.000,1.0,-2152.66),
Median = c("2024-01-05 00:00:00",30.00,2.000,50.81,3.800,48.24,119.96,2.000,7.000,4.0,-0.42),
Max = c("2024-12-31 00:00:00",74.00,6.000,463.49,30.000,463.30,2758.98,21.000,39.000,25.0,898.42))
ringkasan_stat_deskriptif_quanti
ringkasan_stat_deskriptif_quali <- data.frame(
Variabel = c("Product","Category","Payment_Method"),
Paling_Sedikit = c("Honey","Muffins","Wallet"),
Paling_Banyak = c("Bread","Beverages","UPI"))
ringkasan_stat_deskriptif_quali
hist(data_uts$Selling_Price,
main = "Histogram Harga Jual Per Unit",
xlab = "Harga Jual",
ylab = "Frekuensi",
col = "green",
border = "black",
breaks = 30)
hist(data_uts$Profit,
main = "Histogram Keuntungan Penjualan",
xlab = "Keuntungan",
ylab = "Frekuensi",
col = "skyblue",
border = "black")
boxplot(data_uts$Profit,
main = "Boxplot Keuntungan Penjualan",
ylab = "Profit",
col = "skyblue",
border = "blue")
data_uts$Date <- as.Date(data_uts$Date)
data_uts$Month <- format(data_uts$Date, "%Y-%m")
total_bill_month <- aggregate(
Total_Bill ~ Month,
data = data_uts,
FUN = sum,
na.action = na.omit
)
plot(
x = seq_len(nrow(total_bill_month)),
y = total_bill_month$Total_Bill,
type = "o",
xaxt = "n",
main = "Total Bill per Month",
xlab = "Month",
ylab = "Total Bill",
col = "red"
)
axis(
1,
at = seq_len(nrow(total_bill_month)),
labels = total_bill_month$Month
)