library(readxl)
library(tidyverse)
## -- Attaching packages ------------------------------------------------------------------------------------ tidyverse 1.2.1 --
## <U+221A> ggplot2 3.1.0 <U+221A> purrr 0.2.5
## <U+221A> tibble 1.4.2 <U+221A> dplyr 0.7.8
## <U+221A> tidyr 0.8.2 <U+221A> stringr 1.3.1
## <U+221A> readr 1.1.1 <U+221A> forcats 0.3.0
## -- Conflicts --------------------------------------------------------------------------------------- tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
library(ggplot2)
dat <- readRDS("car_data_aggregate.rds")
head and tail of excel data
head(dat)
## # A tibble: 6 x 12
## brand_name auto_dom auto_imp auto_total comm_dom comm_imp comm_total
## <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 ALFA ROMEO 0 13 13 0 0 0
## 2 ASTON MAR~ 0 2 2 0 0 0
## 3 AUDI 0 350 350 0 0 0
## 4 BENTLEY 0 0 0 0 0 0
## 5 BMW 0 158 158 0 0 0
## 6 CITROEN 0 134 134 0 197 197
## # ... with 5 more variables: total_dom <dbl>, total_imp <dbl>,
## # total_total <dbl>, year <dbl>, month <dbl>
tail(dat)
## # A tibble: 6 x 12
## brand_name auto_dom auto_imp auto_total comm_dom comm_imp comm_total
## <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 SSANGYONG 0 19 19 0 3 3
## 2 TATA 0 0 0 0 9 9
## 3 TOYOTA 1298 149 1447 0 34 34
## 4 VOLKSWAGEN 0 2792 2792 0 1736 1736
## 5 VOLVO 0 187 187 0 0 0
## 6 TOPLAM: 7375 15983 23358 4815 4540 9355
## # ... with 5 more variables: total_dom <dbl>, total_imp <dbl>,
## # total_total <dbl>, year <dbl>, month <dbl>
dat %>%
select(brand_name,auto_dom) %>%
arrange(auto_dom) %>%
filter(auto_dom>0)
## # A tibble: 206 x 2
## brand_name auto_dom
## <chr> <dbl>
## 1 FORD 91
## 2 FORD 139
## 3 FORD 153
## 4 FORD 155
## 5 FORD 229
## 6 FORD 242
## 7 FORD 280
## 8 FORD 287
## 9 FORD 304
## 10 FORD 315
## # ... with 196 more rows
On above, companies of maked car sales.
On the below, Some Filter Added to show sales of car clearly in April of 2017.
dat %>%
select(brand_name,auto_dom,comm_dom,total_imp,total_dom) %>%
arrange(auto_dom) %>% arrange(total_imp) %>%
filter(comm_dom>0) %>% filter(auto_dom>0) %>% filter(total_imp >0)
## # A tibble: 78 x 5
## brand_name auto_dom comm_dom total_imp total_dom
## <chr> <dbl> <dbl> <dbl> <dbl>
## 1 FIAT 1979 1962 219 3941
## 2 FIAT 632 789 256 1421
## 3 FIAT 1602 1090 315 2692
## 4 FIAT 2275 2500 354 4775
## 5 FIAT 3720 1787 360 5507
## 6 FIAT 3106 1689 362 4795
## 7 FIAT 1515 1988 363 3503
## 8 FIAT 4175 3183 379 7358
## 9 FIAT 1465 1944 434 3409
## 10 FIAT 2678 2771 480 5449
## # ... with 68 more rows