loading dataset

bakery_sales <- read.csv('BakeryProject/Bakery sales.csv')
library(ggplot2)
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union

converting

croissant_sales <- subset(bakery_sales, article == 'CROISSANT')
coffee_sales <- subset(bakery_sales, article == 'CAFE OU EAU')

Histogram

Made a histogram that shows the distrubustion of coffee that is purchased throughout the year

coffee_sales$date <- as.Date(coffee_sales$date, format="%Y-%m-%d")
coffee_sales$month <- format(coffee_sales$date, "%B")
coffee_sales$month <- factor(coffee_sales$month, levels = month.name)
ggplot(coffee_sales, aes(x = month)) +
  geom_histogram(stat = "count", fill = "lightblue", color = "black") +
  labs(title = "Distribution of Coffee Purchases by Month", 
       x = "Month", 
       y = "Number of Coffee Purchases") +
  theme_minimal() +
  theme(axis.text.x = element_text(angle = 45, hjust = 1))  
## Warning in geom_histogram(stat = "count", fill = "lightblue", color = "black"):
## Ignoring unknown parameters: `binwidth`, `bins`, and `pad`

## line plot of crossiant sales between 9am to 11am

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