Chapter 65 Inspection Results for Top Twenty Facility Types

FoodInspections %>%
  mutate(FacilityType = as.factor(`Facility Type`)) %>%
  filter(FacilityType %in% TopFacilityTypes$FacilityType) %>%
  group_by(FacilityType,Results) %>%
  dplyr::summarise(CountResults = n()) %>%
  
  ggplot(aes(x = FacilityType,y = CountResults, fill =Results)) +
  geom_bar(stat='identity',colour="white") +
    labs(x = 'FacilityType', y = 'CountResults', 
       title = 'Facilities with Different Results Analysis') +
  coord_flip() + 
  theme_bw()