Analytic

  1. The restaurants were displayed in the order they were because they are arranged in decreasing order of ‘Overall’ average customer rating by sex and race respectively.

  2. The overall column represents average customer rating without filtering it further on a by-sex or by-race basis.

  3. The overall column was added to the table in the position it was because logically, it is the ‘overall’ average and remains unchanged by the fields that follow it. It is the basic practice that we use everywhere. Provide a bird’s eye view first and then dive into the details.

  4. The sex/race columns were grouped together because they individually are a variable which can help understand the demographics of who enters the restaurant. Within race or sex, they are grouped together because all subcategories are the only possible options in that particular category.

data <- read.csv("data.csv")
nrow(data)
## [1] 1075
library(tidyverse)
## ── Attaching packages ─────────────────────────────────────────────────── tidyverse 1.3.0 ──
## ✔ ggplot2 3.3.3     ✔ purrr   0.3.3
## ✔ tibble  2.1.3     ✔ dplyr   1.0.5
## ✔ tidyr   1.0.2     ✔ stringr 1.4.0
## ✔ readr   1.3.1     ✔ forcats 0.4.0
## Warning: package 'ggplot2' was built under R version 3.6.2
## Warning: package 'dplyr' was built under R version 3.6.2
## ── Conflicts ────────────────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
library(dplyr)

Tables and Figures

Find the total number of cases: ‘1075’ For each restaurant, find the total number of customers.

## # A tibble: 4 x 3
##   restaurant  Count Percentage
##   <fct>       <int>      <dbl>
## 1 KFC           284       26.4
## 2 Taco Bell     274       25.5
## 3 Burger King   261       24.3
## 4 McDonald      256       23.8

For each restaurant, find the average star rating by Sex.

Average customer rating by Sex

##             Overall Male Female
## McDonald       3.14 3.14   3.15
## KFC            2.99 3.07   2.92
## Taco Bell      2.81 2.73   2.89
## Burger King    2.80 2.77   2.83

For each restaurant, find the average star rating by Race.

Average customer rating by Race

##             Overall White Blake Hispanic Other
## McDonald       3.14  3.04  3.29     3.18  3.06
## KFC            2.99  2.76  2.91     3.10  3.19
## Taco Bell      2.81  2.94  2.73     2.86  2.71
## Burger King    2.80  2.60  2.86     2.72  3.00