This is my compile markdown with r
studio and this is a compile provides detailed data sales information
for BMW vehicles from 2010 to 2024 across global regions. It includes
attributes such as model, year, engine size, mileage, transmission type,
fuel type, price, and sales volume. Scholars and analysts can use it to
explore market trends, pricing approaches, and customer
favorites.
Sumber
Pengambilan DataSet Kaggle.com
Let’s load some data
library(readxl)
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.4 ✔ readr 2.1.5
## ✔ forcats 1.0.1 ✔ stringr 1.5.2
## ✔ ggplot2 4.0.0 ✔ tibble 3.3.0
## ✔ lubridate 1.9.4 ✔ tidyr 1.3.1
## ✔ purrr 1.1.0
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
BMW_sales_data_2010_2024_ <- read_excel("C:/Users/Mareko/Downloads/archive (7)/BMW sales data (2010-2024).xlsx")
View(BMW_sales_data_2010_2024_)
print(BMW_sales_data_2010_2024_)
## # A tibble: 50,000 × 12
## Model Year Region Color Fuel_Type Transmission Engine_Size_L Mileage_KM
## <chr> <dbl> <chr> <chr> <chr> <chr> <chr> <dbl>
## 1 i8 2010 South A… Black Hybrid Automatic 4.7 16020
## 2 i8 2010 Middle … Grey Petrol Automatic 4.0 98514
## 3 X6 2010 Europe Red Hybrid Manual 3.8 128477
## 4 i8 2010 North A… White Electric Automatic 2.5 75457
## 5 X6 2010 Africa Silv… Petrol Manual 1.7 176650
## 6 M5 2010 South A… White Diesel Manual 2.8 121393
## 7 3 Series 2010 Asia Black Petrol Manual 2.1 107572
## 8 5 Series 2010 Europe Red Petrol Manual 1.8 194101
## 9 i3 2010 Africa Blue Petrol Manual 3.6 91061
## 10 i3 2010 Africa Blue Diesel Manual 1.8 120482
## # ℹ 49,990 more rows
## # ℹ 4 more variables: Price_USD <dbl>, Sales_Volume <dbl>,
## # Sales_Classification <chr>, New_Count <dbl>
summary(BMW_sales_data_2010_2024_)
## Model Year Region Color
## Length:50000 Min. :2010 Length:50000 Length:50000
## Class :character 1st Qu.:2013 Class :character Class :character
## Mode :character Median :2017 Mode :character Mode :character
## Mean :2017
## 3rd Qu.:2021
## Max. :2024
## Fuel_Type Transmission Engine_Size_L Mileage_KM
## Length:50000 Length:50000 Length:50000 Min. : 3
## Class :character Class :character Class :character 1st Qu.: 50178
## Mode :character Mode :character Mode :character Median :100389
## Mean :100307
## 3rd Qu.:150630
## Max. :199996
## Price_USD Sales_Volume Sales_Classification New_Count
## Min. : 30000 Min. : 100 Length:50000 Min. :1
## 1st Qu.: 52435 1st Qu.:2588 Class :character 1st Qu.:1
## Median : 75012 Median :5087 Mode :character Median :1
## Mean : 75035 Mean :5068 Mean :1
## 3rd Qu.: 97628 3rd Qu.:7537 3rd Qu.:1
## Max. :119998 Max. :9999 Max. :1
This Data is to much for us to compile so, I create or
minimalize to 100 data with this code :
BMWSD = head(BMW_sales_data_2010_2024_, 100)
print(BMWSD)
## # A tibble: 100 × 12
## Model Year Region Color Fuel_Type Transmission Engine_Size_L Mileage_KM
## <chr> <dbl> <chr> <chr> <chr> <chr> <chr> <dbl>
## 1 i8 2010 South A… Black Hybrid Automatic 4.7 16020
## 2 i8 2010 Middle … Grey Petrol Automatic 4.0 98514
## 3 X6 2010 Europe Red Hybrid Manual 3.8 128477
## 4 i8 2010 North A… White Electric Automatic 2.5 75457
## 5 X6 2010 Africa Silv… Petrol Manual 1.7 176650
## 6 M5 2010 South A… White Diesel Manual 2.8 121393
## 7 3 Series 2010 Asia Black Petrol Manual 2.1 107572
## 8 5 Series 2010 Europe Red Petrol Manual 1.8 194101
## 9 i3 2010 Africa Blue Petrol Manual 3.6 91061
## 10 i3 2010 Africa Blue Diesel Manual 1.8 120482
## # ℹ 90 more rows
## # ℹ 4 more variables: Price_USD <dbl>, Sales_Volume <dbl>,
## # Sales_Classification <chr>, New_Count <dbl>
summary(BMWSD)
## Model Year Region Color
## Length:100 Min. :2010 Length:100 Length:100
## Class :character 1st Qu.:2010 Class :character Class :character
## Mode :character Median :2010 Mode :character Mode :character
## Mean :2010
## 3rd Qu.:2010
## Max. :2010
## Fuel_Type Transmission Engine_Size_L Mileage_KM
## Length:100 Length:100 Length:100 Min. : 3514
## Class :character Class :character Class :character 1st Qu.: 46205
## Mode :character Mode :character Mode :character Median :105041
## Mean :103430
## 3rd Qu.:152912
## Max. :199290
## Price_USD Sales_Volume Sales_Classification New_Count
## Min. : 30946 Min. : 184 Length:100 Min. :1
## 1st Qu.: 48255 1st Qu.:2706 Class :character 1st Qu.:1
## Median : 67198 Median :5824 Mode :character Median :1
## Mean : 72359 Mean :5499 Mean :1
## 3rd Qu.: 99819 3rd Qu.:8095 3rd Qu.:1
## Max. :117253 Max. :9996 Max. :1
Basicly I just take a 2010 sample for my presentation, why?
because the minimal data is 2010 in year section on the max side is also
2010
Main Focus
MILEAGE KILOMETER =
summary(BMWSD$Mileage_KM)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 3514 46205 105041 103430 152912 199290
mean(BMWSD$Mileage_KM)
## [1] 103430
median(BMWSD$Mileage_KM)
## [1] 105041
names(sort(-table(BMWSD$Mileage_KM)))[1]
## [1] "191728"
PRICE USD =
summary(BMWSD$Price_USD)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 30946 48255 67198 72359 99819 117253
mean(BMWSD$Price_USD)
## [1] 72358.59
median(BMWSD$Price_USD)
## [1] 67198
names(sort(-table(BMWSD$Price_USD)))[1]
## [1] "30946"
Sales Volume =
summary(BMWSD$Sales_Volume)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 184 2706 5824 5499 8095 9996
mean(BMWSD$Sales_Volume)
## [1] 5499.05
median(BMWSD$Sales_Volume)
## [1] 5824
names(sort(-table(BMWSD$Sales_Volume)))[1]
## [1] "184"
The Influence of car mileage on car price =
price_car <- c(BMWSD$Price_USD)
cars <- c(BMWSD$Model)
mileage <- c(BMWSD$Mileage_KM)
barplot(price_car, names.arg = cars, main = "BMW Sales 2010")

plot(mileage, price_car, main = "BMW Sales 2010")

PIVOT TABLE
library(pivottabler)
pivot <- qpvt(BMWSD,"Model","Transmission","sum(New_Count)")
print(pivot)
## Automatic Manual Total
## 3 Series 3 2 5
## 5 Series 4 7 11
## 7 Series 6 4 10
## M3 6 4 10
## M5 5 5 10
## X1 5 9 14
## X3 5 2 7
## X5 6 4 10
## X6 2 5 7
## i3 2 4 6
## i8 9 1 10
## Total 53 47 100
Automatic = c(3,4,6,2,9,6,5,5,5,6,2)
Model_Series = c("3 Series","5 Series","7 Series","i3","i8","M3","M5","X1","X3","X5","X6")
pct <- round(Automatic/sum(Automatic)*100)
Model_Series <- paste(Model_Series,"=", pct)
Model_Series <- paste(Model_Series, "%",sep = "")
pie(Automatic, labels = Model_Series,col = rainbow(length(Model_Series)), main = "Presentase Automatic/Matic")

Automatic = c(2,7,4,4,1,4,5,9,2,4,5)
Model_Series = c("3 Series","5 Series","7 Series","i3","i8","M3","M5","X1","X3","X5","X6")
pct <- round(Automatic/sum(Automatic)*100)
Model_Series <- paste(Model_Series,"=", pct)
Model_Series <- paste(Model_Series, "%",sep = "")
pie(Automatic, labels = Model_Series,col = rainbow(length(Model_Series)), main = "Presentase Manual")
