Ferdi Atesin ,
I am interested in September 2017 sales. First we need to get our data from the web site
Initially, we need to download tidyverse package
library(tidyverse)
## -- Attaching packages --------------------------------------------------------------------------- tidyverse 1.2.1 --
## v ggplot2 3.0.0 v purrr 0.2.5
## v tibble 1.4.2 v dplyr 0.7.6
## v tidyr 0.8.1 v stringr 1.3.1
## v readr 1.1.1 v forcats 0.3.0
## -- Conflicts ------------------------------------------------------------------------------ tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
tmp<-tempfile(fileext="odd_retail_sales_2017_09(fixed).xlsx")
download.file("https://github.com/MEF-BDA503/pj18-ferdiatesin/blob/master/odd_retail_sales_2017_09(fixed).xlsx?raw=true",destfile=tmp, mode='wb')
raw_data<-readxl::read_excel(tmp,skip=7,col_names=FALSE)
file.remove(tmp)
raw_data <- raw_data %>% slice(-c(46,47))
head(raw_data)
colnames(raw_data) <- c("brand_name","auto_dom","auto_imp","auto_total","comm_dom","comm_imp","comm_total","total_dom","total_imp","total_total")
car_data_sep_17 <- raw_data %>% mutate_if(is.numeric,funs(ifelse(is.na(.),0,.))) %>% mutate(year=2017,month=9)
print(car_data_sep_17,width=Inf)
saveRDS(car_data_sep_17,file="~/desktop/odd_car_sales_data_sep_17(fixed).rds")
You can also embed plots