Chapter 5 Results

Questions:

  1. Which part of NYC has restaurants with relatively low grades and relatively high grades?

  2. Is there a relationship between the type of restaurants and the type of violations?

  3. Are there any trends of scores for each cuisine type as time goes by?

  4. For the franchise restaurants, what type of violations are most common and what might be the reasons?

5.1 Restaurant Distribution

First, take a look at the distributions of all restaurants inspected in NYC. Each point in the following map represents a unique restaurant. It is clear that Manhattan has the highest density of restaurant distribution among all boroughs. The density is also quite high along the coastline for Queens and Brooklyn compared to the densities in the other areas.

## [1] TRUE

Here is an interactive map to show the number of restaurants in each selected area. Zoom-in and Zoom-out allow for inspection on smaller and larger scale. The color of the circles indicates the quantity of restaurants in the surrounding area as follows: Red, over 100; Yellow, between 10 and 100; Green, less than 10. When you move your mouse on a circle, the corresponding surrounding area is shaded by blue.

5.2 Cuisine Types

Now we will take a look at the cuisine type of all restaurants inspected. we notice that American and Chinese cuisines take a large percentage in the restaurants inspected. Since the dataset is quite general on all active restaurants in NYC, we can tell that most of the restaurants are American or Chinese in NYC. The number of American restaurants is over 80,000, which is quite surprising for us as this number is much larger than we thought it to be.

## # A tibble: 84 x 2
##    CUISINE.DESCRIPTION     n
##    <fct>               <int>
##  1 Afghan                207
##  2 African              1758
##  3 American            83240
##  4 Armenian              300
##  5 Asian                6222
##  6 Australian            403
##  7 Bagels/Pretzels      2577
##  8 Bakery              12357
##  9 Bangladeshi          1210
## 10 Barbecue              778
## # … with 74 more rows

5.3 Boroughs vs Cuisine Types

Now we are interested in exploring whether there is a relationship between boroughs and cuisine types. Here we use a stacked bar chart with each bar representing a certain cuisine type and fill each bar according to the percentage of this type in each borough. Note that we only take into account the cuisine types with quantities over 100 in each borough to reduce the complexity of the chart and make it more clear. Since each of the restaurant is inspected more than once, we only count each restaurant once by select distinct rows.

The graph above shows the proportion of each cuisine type in each borough. It is clear that most of the restaurants are in Manhattan, Brooklyn and Queens, which is not surprising. However, there are some interesting trends that worth being pointed out. Most of the Korean restaurants are in Queens, which is not as we expected it to be since there is a k-town area in Manhattan and we expected there are more Korean restaurants in Manhattan. However, there is also a bigger k-town in Queens, which is non-Manhattan prices and less touristy. This explains why there are more Korean restaurants in Queens. Another interesting observation is that more than 3/4 of the French restaurants are in Manhattan. There is no official explanation for this condition. However, what we think might be the reason is that French restaurants are usually of premium qualities and also higher prices. Since people living in Manhattan are more likely to have higher incomes and there are also more tourists in Manhattan who are willing to pay higher prices for meals, the French restaurants, targeting these kinds of people, are more likely to run business in Manhattan.

5.4 Grades vs Cuisine Types

Now we want to take a look at the grades according to each cuisine type. As mentioned before in the data section, there are more than one inspection types and here we divide all inspection types into two groups-initial inspection and re-inspection. For initial inspections, the grades are either “A” or “NA”. For re-inspections, the grades are given as “A”, “B”, “C”, “Z” or “P”.

## # A tibble: 33 x 2
##    INSPECTION.TYPE                                               num
##    <fct>                                                       <int>
##  1 ""                                                           1701
##  2 Administrative Miscellaneous / Compliance Inspection          122
##  3 Administrative Miscellaneous / Initial Inspection            7056
##  4 Administrative Miscellaneous / Re-inspection                 2071
##  5 Administrative Miscellaneous / Reopening Inspection           103
##  6 Administrative Miscellaneous / Second Compliance Inspection    18
##  7 Calorie Posting / Compliance Inspection                        15
##  8 Calorie Posting / Initial Inspection                         1111
##  9 Calorie Posting / Re-inspection                               229
## 10 Cycle Inspection / Compliance Inspection                      738
## # … with 23 more rows

The chart above shows all kinds of different inspections and we divide them as “initial inspection” and “re-inspection”.

#initial inspection for “A” or “NA”

The gif above shows the proportions of grade “A” or “NA” of each cuisine type for the initial inspections. Note that most cuisine types got more “NA”s than “A”s for the initial inspection. However, there are some cuisine types which got more “A”s than “NA”s for the initial inspections, including “Barbecue”, “Basque”, “Czech”, “Donuts”, “Hamburgers” and “Hotdogs”. Among all these cuisine types, only “Basque” and “Czech” are not of fast-food franchise and have relatively smaller number of restaurants. The reason these two cuisine types got more “A”s is that these two types of cuisines are usually of high qualities and also higher prices, thus more likely to be rated “A”. The rest cuisine types are likely to be franchises and have a large number of restaurants under each brand. Since the requirements for franchises are higher to keep the reputation of a certain brand, these types of cuisines are also more likely to be given a better grade.

#reinspection for “A”, “B” or “C”

The gif above shows the proportions of grade “A”, “B” or “C” of each cuisine type for the re-inspections. Here we exclude “P” and “Z” as we want to discuss these two cases seperately. Since these two grades only take a small portions in total, excluding them won’t have large effects on the graph. According to the gif, we can tell that all cuisine types got more “A”s than “B”s or “C”s for the re-inspections. There are two cuisine types with no data for the re-inspections-“Barbecue” and “Basque”, indicating that restaurants of these two cuisine types were only inspected once for initial inspections. There are also two cuisine types got only “A”s for the re-inspections-“Chilean” and “Czech”, indicating that all restaurants of these two cuisine types got “A”s for both initial and re-inspections, which makes sense as there’s only one restaurant of type “Chilean” and four restaurants of type “Czech” in total.

#reinspection for “Z” or “P”

The gif above shows the proportions of grade “Z” or “P” of each cuisine type for the re-inspections. As mentioned in the data section, “Z” means “grade pending” and “P” means “Grade Pending issued on re-opening following an initial inspection that resulted in a closure”. These two types of grades are always resulted from serious problems in the initial inspections. As shown in the gif, we can tell that there are some restaurants with serious problems in the initial inspection for most of the cuisine types. There are also some cuisine types with no restaurants having serious problems for the initial inspections, inlcuding “Barbecue”, “Basque”, “Cajun”, “Californian”, “Czech”, “English” and “Fruits and Vegetables”.

5.5 Scores vs Cuisine Types as Time Changes

We are also interested at the trends of how the scores change for each cuisine type as time goes by. We calculate the average scores for all restaurants under each cuisine types for each quarter starting from 2013 till current time.

#quarter-averageScore(faceted by cuisine type)

The gif above shows the changes of the scores for each cuisine types from 2012 till current time. As mentioned in the data section, lower scores lead to better grades. From the gif, we can tell that the average scores for all cuisine types are between 10 and 20 in most of the quarters. For most cuisine types, there are no obvious contionus increasing or decreasing trends in scores as a whole pattern as time goes by, ignoring the changes of scores back and forth in bwtween. However, there are some cuisine types showing a weak trend of increasing in scores, including “Afghan”, “African”, “Asian”, “Australian”, “Bakery”, “Barbecue”, “Eastern European” and “German”.

5.6 Boroughs vs Grades

Then we consider that the boroughs might also have some effects on the grades of restaurants, so we explore the grades of restaurants in different boroughs.

From the bar charts above, we can get the general idea of how the grades are related to boroughs. Since the distributions of the number of restaurants in each borough are very similar under each score, we can conclude that the grades of restaurants have almost no relationship with boroughs.

To get a more detailed view of the relationship, we draw another version of the same data below. Here we count the proportion of each grade in each borough. Note that this bar chart makes more sense since it is the proportion that really matters instead of the number itself.

The graph above shows the same result as we mentioned before-the grades of restaurants are not much affected by the boroughs. We can tell that although the proportion of each grade differs a little for each borough, there is no big difference that worth taking into account.

5.7 Cuisine Types vs Violation Types

Will restaurants have different types of violations according to thier cuisine types? Here we try to find out whether there is a relationship between the cuisine types and the violation types accordingly. Since there are a total of 84 cuisine types and a total of 75 violation types, which will be too complicated if all been used, we only choose the 14 most common cusine types and the 9 most common violation types in this case.

Above is the graph showing the proportion of violation types for each cuisine type. There is no obvious relationship between the cuisine types and the violation types. However, it’s not hard to identify that the bars for violation code 10F are higher much higher for restaurants of cuisine types “Cafe” and “Dounts”. The restaurants of cuisine type “chicken” also have relatively high proportion of violation type 10F. Note that the proportions for violation type with code 02B are realtively small for cuusine types “Cafe” and “Donuts” at the same time.

The description of 10F is “Non-food contact surface improperly constructed. Unacceptable material used. Non-food contact surface or equipment improperly maintained and/or not properly sealed, raised, spaced or movable to allow accessibility for cleaning on all sides, above and underneath the unit.” and the description of 02B is “Hot food item not held at or above 140 F.” The reason for his similarity between “Cafe” and “Donuts” might be that both cuisine types serve desserts and drinks and might have special requirements for food and drink preperations.

5.8 Franchise vs Violation Types

There are a number of franchise restaurants in NYC, including Starbucks, Subway, Burgur King and so on. We want to identify the most common violation types for each franchise. We choose the franchise with more than 500 observations, which are the 9 franchises with the largest numbers of observations. Since there are a number of violation types, we choose 9 most common violation types among all.

The franchises selected are “BURGER KING”, “CROWN FRIED CHICKEN”, “DUNKIN’”, “DUNKIN’, BASKIN ROBBINS”, “KENNEDY FRIED CHICKEN”, “MCDONALD’S”, “POPEYES”, “STARBUCKS” and “SUBWAY”.

## # A tibble: 9 x 2
##   DBA                       num
##   <fct>                   <int>
## 1 BURGER KING               638
## 2 CROWN FRIED CHICKEN       516
## 3 DUNKIN'                  2762
## 4 DUNKIN', BASKIN ROBBINS   786
## 5 KENNEDY FRIED CHICKEN     683
## 6 MCDONALD'S               1324
## 7 POPEYES                   591
## 8 STARBUCKS                1503
## 9 SUBWAY                   1789

The chart above shows the franchise names with the largest numbers of observations and the according observation numbers for each franchise.

Here we select the most common violation types.

##   VIOLATION.CODE
## 1            04L
## 2            02G
## 3            10B
## 4            06C
## 5            10F
## 6            06D
## 7            08A
## 8            02B
## 9            04N
##                                                                                                                                                                                                                                                                                  VIOLATION.DESCRIPTION
## 1                                                                                                                                                                                                                      Evidence of mice or live mice present in facility's food and/or non-food areas.
## 2                                                                                                                                                       Cold food item held above 41\xe5\xbc F (smoked fish and reduced oxygen packaged foods above 38 \xe5\xbcF) except during necessary preparation.
## 3                                                                   Plumbing not properly installed or maintained; anti-siphonage or backflow prevention device not provided where required; equipment or floor not properly drained; sewage disposal system in disrepair or not functioning properly.
## 4                                                                                                                                                                           Food not protected from potential source of contamination during storage, preparation, transportation, display or service.
## 5                      Non-food contact surface improperly constructed. Unacceptable material used. Non-food contact surface or equipment improperly maintained and/or not properly sealed, raised, spaced or movable to allow accessibility for cleaning on all sides, above and underneath the unit.
## 6                                                                                                                                                       Food contact surface not properly washed, rinsed and sanitized after each use and following any activity when contamination may have occurred.
## 7                                                                                                                                                                   Facility not vermin proof. Harborage or conditions conducive to attracting vermin to the premises and/or allowing vermin to exist.
## 8                                                                                                                                                                                                                                                    Hot food item not held at or above 140\xe5\xbc F.
## 9 Filth flies or food/refuse/sewage-associated (FRSA) flies present in facility\x89۪s food and/or non-food areas. Filth flies include house flies, little house flies, blow flies, bottle flies and flesh flies. Food/refuse/sewage-associated flies include fruit flies, drain flies and Phorid flies.

The chart above shows the most common violation codes and the according descriptions.

Above is the graph showing the proportion of violation types for each franchise. Note that the violation type with violation code 10F is the most common one for all of the franchises. The description of this violation is “Non-food contact surface improperly constructed. Unacceptable material used. Non-food contact surface or equipment improperly maintained and/or not properly sealed, raised, spaced or movable to allow accessibility for cleaning on all sides, above and underneath the unit.”

The violation types with codes 10B and 08A are also very common among all restaurants, with the descriptions-“Plumbing not properly installed or maintained; anti-siphonage or backflow prevention device not provided where required; equipment or floor not properly drained; sewage disposal system in disrepair or not functioning properly.” and “Facility not vermin proof. Harborage or conditions conducive to attracting vermin to the premises and/or allowing vermin to exist.”

The violation types with code 06D is common for “DUNKIN’”, “DUNKIN’, BASKIN ROBBINS” and “SUBWAY”, with the description “Food contact surface not properly washed, rinsed and sanitized after each use and following any activity when contamination may have occurred.” The reason for this similarity might be that “DUNKIN” and “SUBWAY” mainly serve bread and donuts and this violation might be common for this type of cuisines.