Chapter 68 Trend of Inspections Daywise

We examine the Inspections from the day of week perspective. Wednesday is the day which has the lowest inspections.

FoodInspections %>%
  select(Results,`Inspection Date`) %>%
  mutate(Results =  as.factor(Results)) %>%
  dplyr::rename(InspectionDate = `Inspection Date`) %>%
  mutate(dayOfWeek = wday(mdy(InspectionDate),label = TRUE)) %>%
  
  group_by(dayOfWeek,Results) %>%
  dplyr::summarise(InspectionsCount = n()) %>%
  
  
  ggplot(aes(x=dayOfWeek,y=InspectionsCount, fill=Results)) +
  geom_bar(stat = 'identity') +
  labs(x = 'Day of Week', y = 'Count of Inspections', 
       title = 'Trend of Inspections Day Wise') +
  theme_bw() +  theme(legend.position="top")