R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

Including Plots

You can also embed plots, for example:

Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.

Supermarket Sales

In this workshop we will analyze a supermarket dataset to uncover insights about sales performance; customer behaviour, trends Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.

Data Loading

{r} #install.packages('readr') library(readr) sales_date <- read.csv("C:/Users/User/Downloads/supermarket_sales - Sheet1.csv") head(sales_date)

{r} #summary(sales_date) colSums(is.na) str(sales_date)

{r} colSums(is.na(sales_date)) head(sales_date)

{r} #Total sales by city #tibble learn #install.packages("dplyr") library(dplyr) sales_city <- sales_date %>% group_by(City) %>% summarise(sum(Total)) sales_city

library(dplyr)

sales_city <- sales_date %>% mutate(City = recode(City, "Mel" = "Mandalay"))

{r} #viscerplot #sweetviz install.packages("ggplot2") library(ggplot2) ggplot(sales_date, aes(x = City)) + geom_bar(fill = "steelblue") + labs(title = "Sales Count by City", x = "City", y = "Count") + theme_minimal()