library(readxl)
data_uts <- read_excel(
"C:/Users/Moses/Documents/bakery_synthetic_dataset.csv (1).xlsx",
col_names = TRUE
)
data_uts
summary(data_uts)
## Date Customer_Age Product
## Min. :2023-01-01 00:00:00 Min. :16.00 Length :16569
## 1st Qu.:2023-07-06 00:00:00 1st Qu.:23.00 N.unique : 35
## Median :2024-01-05 00:00:00 Median :30.00 N.blank : 0
## Mean :2024-01-04 00:36:45 Mean :34.48 Min.nchar: 3
## 3rd Qu.:2024-07-06 00:00:00 3rd Qu.:44.00 Max.nchar: 17
## Max. :2024-12-31 00:00:00 Max. :74.00
## Category Quantity Unit_Price Discount_Percentage
## Length :16569 Min. :1.000 Min. : 24.25 Min. : 0.000
## N.unique : 10 1st Qu.:2.000 1st Qu.: 39.54 1st Qu.: 0.000
## N.blank : 0 Median :2.000 Median : 50.81 Median : 3.800
## Min.nchar: 5 Mean :2.591 Mean : 85.69 Mean : 6.656
## Max.nchar: 18 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 N.unique : 4 1st Qu.: 2.000
## Median : 48.24 Median : 119.96 N.blank : 0 Median : 2.000
## Mean : 79.96 Mean : 207.86 Min.nchar: 3 Mean : 2.748
## 3rd Qu.: 70.55 3rd Qu.: 209.11 Max.nchar: 6 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"
modus_Category <- names(which.max(table(data_uts$Category)))
paste("Modus data kolom Category :",modus_Category)
## [1] "Modus data kolom Category : Beverages"
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"
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"
#kuantitatif
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
#kualitatif
##visualisasi data
hist(data_uts$Selling_Price,
main = "Histogram Unit Terjual",
xlab = "Unit Produced",
ylab = "Unit SOld",
col = "green",
border = "black",
breaks = 30)
##Alasan pemilihan plot #histogram dipilih karena kedua variabel merupakan data numerik yang jumlahnya dapat dihitung, sehingga histogram memudahkan kita memahami distribusi data, frekuensi kemunculan nilai dalam rentang tertentu, dan pola penyebaran data.