#Load required packages
library(tidyverse)
## Warning: package 'tidyverse' was built under R version 4.0.5
## -- Attaching packages --------------------------------------- tidyverse 1.3.1 --
## v ggplot2 3.3.3 v purrr 0.3.4
## v tibble 3.1.1 v dplyr 1.0.6
## v tidyr 1.1.3 v stringr 1.4.0
## v readr 1.4.0 v forcats 0.5.1
## Warning: package 'tibble' was built under R version 4.0.5
## Warning: package 'tidyr' was built under R version 4.0.5
## Warning: package 'stringr' was built under R version 4.0.4
## -- Conflicts ------------------------------------------ tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
library(plotly)
## Warning: package 'plotly' was built under R version 4.0.4
##
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
##
## last_plot
## The following object is masked from 'package:stats':
##
## filter
## The following object is masked from 'package:graphics':
##
## layout
#Setup work directory
setwd("C:/Users/mivul/OneDrive/Desktop/Data 110/Datasets")
#Upload McDonald menu csv file
mcd <-read.csv("menu.csv")
To analyze combinations of menu items, We will use the dataset to conduct simulations of possible orders consisting of three distinct menu items. Due to McDonald’s currently suspending all day breakfast service, we will create two separate tables for the breakfast menu and the dinner menu.
#Create tibble with only breakfast items
breakfast <- mcd %>%
#filter to remove categories not offered during breakfast
filter(Category != "Beef & Pork") %>%
filter(Category != "Chicken & Fish") %>%
filter(Category != "Salads") %>%
#filter to remove menu items not offered during breakfast which are in categories with breakfast items
filter(!Item %in% c("Chipotle BBQ Snack Wrap (Crispy Chicken)", "Chipotle BBQ Snack Wrap (Grilled Chicken)", "Honey Mustard Snack Wrap (Crispy Chicken)", "Honey Mustard Snack Wrap (Grilled Chicken)",
"Ranch Snack Wrap (Crispy Chicken)",
"Ranch Snack Wrap (Grilled Chicken)",
"Small French Fries",
"Medium French Fries",
"Large French Fries",
"Kids French Fries",
"Side Salad",
"Fruit 'n Yogurt Parfait", "Kids Ice Cream Cone",
"Hot Fudge Sundae",
"Hot Caramel Sundae",
"Strawberry Sundae",
"Vanilla Shake (Small)",
"Vanilla Shake (Medium)",
"Vanilla Shake (Large)",
"Strawberry Shake (Small)",
"Strawberry Shake (Medium)",
"Strawberry Shake (Large)",
"Chocolate Shake (Small)",
"Chocolate Shake (Medium)",
"Chocolate Shake (Large)",
"Shamrock Shake (Medium)",
"Shamrock Shake (Large)",
"McFlurry with M&M’s Candies (Small)",
"McFlurry with M&M’s Candies (Medium)",
"McFlurry with M&M’s Candies (Snack)",
"McFlurry with Oreo Cookies (Small)",
"McFlurry with Oreo Cookies (Medium)",
"McFlurry with Oreo Cookies (Snack)",
"McFlurry with Reese's Peanut Butter Cups (Medium)",
"McFlurry with Reese's Peanut Butter Cups (Snack)"))
#Create tibble with only dinner items
dinner <- mcd %>%
filter(Category != "Breakfast")
A tibble was created without the category variable. The tibble will be used to conduct an inner join with the combination tibble to append the nutritional information values for each combination.
#Create table to conduct join to acquire nutritional information
mcd_cal_item<- mcd%>%
select(!Category)
The combination function is utilized on the dinner and breakfast tibbles to create orders consisting of three items.
#Conduct dinner combinations of m number of values from the item vector
dinner_combo <- combn(m=3,x=dinner$Item)
#Transpose matrix to align combinations by row instead of columns
t_dinner_combo <- t(dinner_combo)
#convert matrix to a tibble
df_dinner_combo <- as_tibble(t_dinner_combo)
## Warning: The `x` argument of `as_tibble.matrix()` must have unique column names if `.name_repair` is omitted as of tibble 2.0.0.
## Using compatibility `.name_repair`.
#Conduct inner join to append the nutritional variables for each item in the menu tibble
dinner_menu<- df_dinner_combo %>%
inner_join(mcd_cal_item, by = c( "V1"= "Item")) %>%
inner_join(mcd_cal_item, by = c( "V2"= "Item")) %>%
inner_join(mcd_cal_item, by = c( "V3" = "Item"))
#Calculate the total nutritional variables for each combination
dinner_menu_calories <-dinner_menu %>%
group_by(V1, V2, V3) %>%
summarise(total_calories = Calories.x + Calories.y + Calories, total_sugar = Sugars.x + Sugars.y + Sugars, total_sodium = Sodium.x + Sodium.y + Sodium, total_fat = Total.Fat.x + Total.Fat.y + Total.Fat, total_cholesterol = Cholesterol.x + Cholesterol.y + Cholesterol, total_carbohydrates = Carbohydrates.x + Carbohydrates.y + Carbohydrates, total_protein= Protein.x + Protein.y + Protein, total_dietary_fiber = Dietary.Fiber.x + Dietary.Fiber.y + Dietary.Fiber)
## `summarise()` has grouped output by 'V1', 'V2'. You can override using the `.groups` argument.
#Conduct breakfast combinations of m number of values from the item vector
breakfast_combo <- combn(m=3,x=breakfast$Item)
#Transpose matrix to align combinations by row instead of columns
t_breakfast_combo <- t(breakfast_combo)
#convert matrix to a tibble
df_breakfast_combo <- as_tibble(t_breakfast_combo)
#Conduct inner join to append the nutritional variables values for each item in the menu tibble
breakfast_menu<- df_breakfast_combo %>%
inner_join(mcd_cal_item, by = c( "V1"= "Item")) %>%
inner_join(mcd_cal_item, by = c( "V2"= "Item")) %>%
inner_join(mcd_cal_item, by = c( "V3" = "Item"))
#Calculate the total nutritional variables for each combination
breakfast_menu_calories <-breakfast_menu %>%
group_by(V1, V2, V3) %>%
summarise(total_calories = Calories.x + Calories.y + Calories, total_sugar = Sugars.x + Sugars.y + Sugars, total_sodium = Sodium.x + Sodium.y + Sodium, total_fat = Total.Fat.x + Total.Fat.y + Total.Fat, total_cholesterol = Cholesterol.x + Cholesterol.y + Cholesterol, total_carbohydrates = Carbohydrates.x + Carbohydrates.y + Carbohydrates, total_protein= Protein.x + Protein.y + Protein, total_dietary_fiber = Dietary.Fiber.x + Dietary.Fiber.y + Dietary.Fiber)
## `summarise()` has grouped output by 'V1', 'V2'. You can override using the `.groups` argument.
The top categories are similar between the maintenance and weight loss charts. The top 3 categories for composition of the breakfast menu combinations are coffee and tea, breakfast and beverages categories. The top 3 categories for composition of the dinner menu combinations are chicken and fish, coffee and tea, and beverages.
#Filter breakfast combinations below threshold for maintenance
bfood<-breakfast_menu_calories %>%
filter(total_calories <= 991)
#conduct semi join on Mcdonald's menu to filter for results in the first menu option
bfood2 <-mcd %>%
semi_join(bfood, by = c("Item" = "V1"))
#conduct semi join on Mcdonald's menu to filter for results in the second menu option
bfood3 <- mcd%>%
semi_join(bfood, by = c("Item" = "V2"))
#conduct semi join on Mcdonald's menu to filter for results in the third menu option
bfood4 <-mcd %>%
semi_join(bfood, by = c("Item" = "V3"))
bfood2 %>%
#unit table by rows
rbind(bfood3)%>%
#unit table by rows
rbind(bfood4) %>%
distinct(Category,Item) %>%
count(Category)%>%
#calculate percentage of categories
mutate(percent = n/sum(n))%>%
ggplot(aes(x=Category,y = percent, fill = Category))+
#plot bar graph
geom_bar(stat = "identity")+
coord_flip()+
ylab("Percentage")+
ggtitle("Male Breakfast Maintance Composition")+
theme_classic()
#Filter dinner combinations below threshold for maintenance
dfood<-dinner_menu_calories %>%
filter(total_calories <= 991)
#conduct semi join on Mcdonald's menu to filter for results in the first menu option
dfood2 <-mcd %>%
semi_join(dfood, by = c("Item" = "V1"))
#conduct semi join on Mcdonald's menu to filter for results in the second menu option
dfood3 <-mcd %>%
semi_join(dfood, by = c("Item" = "V2"))
#conduct semi join on Mcdonald's menu to filter for results in the third menu option
dfood4 <-mcd %>%
semi_join(dfood, by = c("Item" = "V3"))
dfood2 %>%
#unit table by rows
rbind(dfood3)%>%
#unit table by rows
rbind(dfood4) %>%
count(Category)%>%
#calculate percentage of categories
mutate(percent = n/sum(n))%>%
ggplot(aes(x=Category,y = percent, fill = Category))+
#plot bar graph
geom_bar(stat = "identity")+
coord_flip()+
ylab("Percentage")+
ggtitle("Male Dinner Maintance Composition")+
theme_classic()
#Filter breakfast combinations below threshold for weight loss
bfood5<-breakfast_menu_calories %>%
filter(total_calories <= 810)
#conduct semi join on Mcdonald's menu to filter for results in the first menu option
bfood6 <-mcd %>%
semi_join(bfood5, by = c("Item" = "V1"))
#conduct semi join on Mcdonald's menu to filter for results in the second menu option
bfood7 <- mcd%>%
semi_join(bfood5, by = c("Item" = "V2"))
#conduct semi join on Mcdonald's menu to filter for results in the third menu option
bfood8 <-mcd %>%
semi_join(bfood5, by = c("Item" = "V3"))
bfood6 %>%
#unit table by rows
rbind(bfood7)%>%
#unit table by rows
rbind(bfood8) %>%
distinct(Category,Item) %>%
count(Category)%>%
#calculate percentage of categories
mutate(percent = n/sum(n))%>%
ggplot(aes(x=Category,y = percent, fill = Category))+
#plot bar graph
geom_bar(stat = "identity")+
coord_flip()+
ylab("Percentage")+
ggtitle("Male Breakfast Weight Loss Composition")+
theme_classic()
#Filter dinner combinations below threshold for weight loss
dfood5<-dinner_menu_calories %>%
filter(total_calories <= 810)
#conduct semi join on Mcdonald's menu to filter for results in the first menu option
dfood6 <-mcd %>%
semi_join(dfood5, by = c("Item" = "V1"))
#conduct semi join on Mcdonald's menu to filter for results in the second menu option
dfood7 <-mcd %>%
semi_join(dfood5, by = c("Item" = "V2"))
#conduct semi join on Mcdonald's menu to filter for results in the third menu option
dfood8 <-mcd %>%
semi_join(dfood5, by = c("Item" = "V3"))
dfood6 %>%
#unit table by rows
rbind(dfood7)%>%
#unit table by rows
rbind(dfood8) %>%
count(Category)%>%
#calculate percentage of categories
mutate(percent = n/sum(n))%>%
ggplot(aes(x=Category,y = percent, fill = Category))+
#plot bar graph
geom_bar(stat = "identity")+
coord_flip()+
ylab("Percentage")+
ggtitle("Male Dinner Weight Loss Composition")+
theme_classic()
Three of the breakfast items were excluded because they could not be combined with any other item to come below the weight maintenance calorie threshold. The average calories of these items was 1097. Four of the breakfast items were excluded because they could not be combined with any other item to come below the weight loss calorie threshold. The average calories of these items was 1070. The Big Breakfast with Hotcakes meals had the highest representation.
One of the dinner items was excluded because it could not be combined with any other item to come below the weight maintenance calorie threshold. This item had 1880 calories. Seven of the dinner items were excluded because they could not be combined with any other item to come below the weight loss calorie threshold. The average calories of these items was 1013. The shakes and chicken nuggets had the highest representation.
#breakfast weight maintenance tables
a<-bfood2 %>%
#unit tables by rows
rbind(bfood3)%>%
#unit tables by rows
rbind(bfood4)
#dinner weight maintenance tables
b<-dfood2 %>%
#unit tables by rows
rbind(dfood3)%>%
#unit tables by rows
rbind(dfood4)
#breakfast weight loss tables
c<-bfood6%>%
#unit tables by rows
rbind(bfood7)%>%
#unit tables by rows
rbind(bfood8)
#dinner weight loss tables
d<-dfood6%>%
#unit tables by rows
rbind(dfood7)%>%
#unit tables by rows
rbind(dfood8)
#breakfast items to avoid for weight maintenance
breakfast%>%
#remove items from breakfast table that are in table a
anti_join(a, by = "Item")%>%
select(Category,Item)
## Category Item
## 1 Breakfast Big Breakfast with Hotcakes (Regular Biscuit)
## 2 Breakfast Big Breakfast with Hotcakes (Large Biscuit)
## 3 Breakfast Big Breakfast with Hotcakes and Egg Whites (Large Biscuit)
#breakfast items to avoid for weight maintenance
breakfast%>%
#remove items from breakfast table that are in table a
anti_join(a, by = "Item") %>%
#calculate average calories
summarise(mean(Calories))
## mean(Calories)
## 1 1096.667
#breakfast items to avoid for weight loss
breakfast%>%
#remove items from breakfast table that are in table c
anti_join(c, by = "Item")%>%
select(Category,Item)
## Category Item
## 1 Breakfast Big Breakfast with Hotcakes (Regular Biscuit)
## 2 Breakfast Big Breakfast with Hotcakes (Large Biscuit)
## 3 Breakfast Big Breakfast with Hotcakes and Egg Whites (Regular Biscuit)
## 4 Breakfast Big Breakfast with Hotcakes and Egg Whites (Large Biscuit)
#breakfast items to avoid for weight loss
breakfast%>%
#remove items from breakfast table that are in table c
anti_join(c, by = "Item")%>%
#calculate average calories
summarise(mean(Calories))
## mean(Calories)
## 1 1070
#dinner items to avoid for weight maintenance
dinner%>%
#remove items from dinner table that are in table b
anti_join(b, by = "Item")%>%
select(Category,Item)
## Category Item
## 1 Chicken & Fish Chicken McNuggets (40 piece)
#dinner items to avoid for weight maintenance
dinner%>%
#remove items from dinner table that are in table b
anti_join(b, by = "Item")%>%
#calculate average calories
summarise(mean(Calories))
## mean(Calories)
## 1 1880
#dinner items to avoid for weight loss
dinner%>%
#remove items from dinner table that are in table d
anti_join(d, by = "Item")%>%
select(Category,Item)
## Category Item
## 1 Chicken & Fish Chicken McNuggets (20 piece)
## 2 Chicken & Fish Chicken McNuggets (40 piece)
## 3 Smoothies & Shakes Vanilla Shake (Large)
## 4 Smoothies & Shakes Strawberry Shake (Large)
## 5 Smoothies & Shakes Chocolate Shake (Large)
## 6 Smoothies & Shakes Shamrock Shake (Large)
## 7 Smoothies & Shakes McFlurry with M&Mâ\200\231s Candies (Medium)
#dinner items to avoid for weight loss
dinner%>%
#remove items from dinner table that are in table d
anti_join(d, by = "Item")%>%
#calculate average calories
summarise(mean(Calories))
## mean(Calories)
## 1 1012.857
The top categories of compositions of the breakfast menu combinations are similar between the maintenance and weight loss charts for the the breakfast menu. The top 3 categories for compositions of the breakfast menu combinations are coffee and tea, breakfast and beverages categories. The top 3 categories for compositions of the dinner menu combinations are chicken and fish, coffee and tea, and beverages to maintain weight. The top 3 categories for compositions of the dinner menu combinations to lose weight are coffee and tea, snacks and sides, and beverages.
#Filter breakfast combinations below threshold for maintenance
bfood9<-breakfast_menu_calories %>%
filter(total_calories <= 790)
#conduct semi join on Mcdonald's menu to filter for results in the first menu option
bfood10<- mcd %>%
semi_join(bfood9, by = c("Item" = "V1"))
#conduct semi join on Mcdonald's menu to filter for results in the second menu option
bfood11<- mcd %>%
semi_join(bfood9, by = c("Item" = "V2"))
#conduct semi join on Mcdonald's menu to filter for results in the third menu option
bfood12<- mcd %>%
semi_join(bfood9, by = c("Item" = "V3"))
bfood10 %>%
#unit table by rows
rbind(bfood11)%>%
#unit table by rows
rbind(bfood12) %>%
count(Category)%>%
#calculate percentage of categories
mutate(percent = n/sum(n))%>%
ggplot(aes(x=Category,y = percent, fill = Category))+
#plot bar graph
geom_bar(stat = "identity")+
coord_flip()+
ylab("Percentage")+
ggtitle("Female Breakfast Combo Composition")+
theme_classic()
#Filter dinner combinations below threshold for maintenance
dfood9<-dinner_menu_calories %>%
filter(total_calories <= 790)
#conduct semi join on Mcdonald's menu to filter for results in the first menu option
dfood10<-mcd %>%
semi_join(dfood9, by = c("Item" = "V1"))
#conduct semi join on Mcdonald's menu to filter for results in the second menu option
dfood11<-mcd %>%
semi_join(dfood9, by = c("Item" = "V2"))
#conduct semi join on Mcdonald's menu to filter for results in the third menu option
dfood12<-mcd %>%
semi_join(dfood9, by = c("Item" = "V3"))
dfood10 %>%
#unit table by rows
rbind(dfood11)%>%
#unit table by rows
rbind(dfood12) %>%
count(Category)%>%
#calculate percentage of categories
mutate(percent = n/sum(n))%>%
ggplot(aes(x=Category,y = percent, fill = Category))+
#plot bar graph
geom_bar(stat = "identity")+
coord_flip()+
ylab("Percentage")+
ggtitle("Female Dinner Combo Composition")+
theme_classic()
#Filter breakfast combinations below threshold for weight loss
bfood13<-breakfast_menu_calories %>%
filter(total_calories <= 636)
#conduct semi join on Mcdonald's menu to filter for results in the first menu option
bfood14<- mcd %>%
semi_join(bfood13, by = c("Item" = "V1"))
#conduct semi join on Mcdonald's menu to filter for results in the second menu option
bfood15<- mcd %>%
semi_join(bfood13, by = c("Item" = "V2"))
#conduct semi join on Mcdonald's menu to filter for results in the third menu option
bfood16<- mcd %>%
semi_join(bfood13, by = c("Item" = "V3"))
bfood14 %>%
#unit table by rows
rbind(bfood15)%>%
#unit table by rows
rbind(bfood16) %>%
count(Category)%>%
#calculate percentage of categories
mutate(percent = n/sum(n))%>%
ggplot(aes(x=Category,y = percent, fill = Category))+
#plot bar graph
geom_bar(stat = "identity")+
coord_flip()+
ylab("Percentage")+
ggtitle("Female Breakfast Combo Composition")+
theme_classic()
#Filter dinner combinations below threshold for weight loss
dfood13<-dinner_menu_calories %>%
filter(total_calories <= 636)
#conduct semi join on Mcdonald's menu to filter for results in the first menu option
dfood14<-mcd %>%
semi_join(dfood13, by = c("Item" = "V1"))
#conduct semi join on Mcdonald's menu to filter for results in the second menu option
dfood15<-mcd %>%
semi_join(dfood13, by = c("Item" = "V2"))
#conduct semi join on Mcdonald's menu to filter for results in the third menu option
dfood16<-mcd %>%
semi_join(dfood13, by = c("Item" = "V3"))
dfood14 %>%
#unit table by rows
rbind(dfood15)%>%
#unit table by rows
rbind(dfood16) %>%
count(Category)%>%
#calculate percentage of categories
mutate(percent = n/sum(n))%>%
ggplot(aes(x=Category,y = percent, fill = Category))+
#plot bar graph
geom_bar(stat = "identity")+
coord_flip()+
ylab("Percentage")+
ggtitle("Female Dinner Combo Composition")+
theme_classic()
Five of the breakfast items were excluded because they could not be combined with any other item to come below the weight maintenance calorie threshold. The average calories of these items was 1016. Twelve of the breakfast items were excluded because they could not be combined with any other item to come below the weight loss calorie threshold. The average calories of these items was 827. The Big Breakfast meals and Frappés had the highest representation.
Eight of the dinner items were excluded because they could not be combined with any other item to come below the weight maintenance calorie threshold. The average calories of the items was 988. Twenty-two of the dinner items were excluded because they could not be combined with any other item to come below the weight loss calorie threshold. The average calories of these items was 800. The shakes and McFlurries had the highest representation.
#breakfast weight maintenance tables
e<-bfood10 %>%
#unit table by rows
rbind(bfood11)%>%
#unit table by rows
rbind(bfood12)
#dinner weight maintenance tables
f<-dfood10 %>%
#unit table by rows
rbind(dfood11)%>%
#unit table by rows
rbind(dfood12)
#breakfast weight loss tables
g<-bfood14%>%
#unit table by rows
rbind(bfood15)%>%
#unit table by rows
rbind(bfood16)
#dinner weight loss tables
h<-dfood14%>%
#unit table by rows
rbind(dfood15)%>%
#unit table by rows
rbind(dfood16)
#breakfast items to avoid for weight maintenance
breakfast%>%
#remove items from breakfast table that are in table e
anti_join(e, by = "Item")%>%
select(Category,Item)
## Category Item
## 1 Breakfast Big Breakfast (Large Biscuit)
## 2 Breakfast Big Breakfast with Hotcakes (Regular Biscuit)
## 3 Breakfast Big Breakfast with Hotcakes (Large Biscuit)
## 4 Breakfast Big Breakfast with Hotcakes and Egg Whites (Regular Biscuit)
## 5 Breakfast Big Breakfast with Hotcakes and Egg Whites (Large Biscuit)
#breakfast items to avoid for weight maintenance
breakfast%>%
#remove items from breakfast table that are in table e
anti_join(e, by = "Item")%>%
#calculate average calories
summarise(mean(Calories))
## mean(Calories)
## 1 1016
#breakfast items to avoid for weight loss
breakfast%>%
#remove items from breakfast table that are in table g
anti_join(g, by = "Item")%>%
select(Category,Item)
## Category Item
## 1 Breakfast Steak, Egg & Cheese Bagel
## 2 Breakfast Big Breakfast (Regular Biscuit)
## 3 Breakfast Big Breakfast (Large Biscuit)
## 4 Breakfast Big Breakfast with Egg Whites (Regular Biscuit)
## 5 Breakfast Big Breakfast with Egg Whites (Large Biscuit)
## 6 Breakfast Big Breakfast with Hotcakes (Regular Biscuit)
## 7 Breakfast Big Breakfast with Hotcakes (Large Biscuit)
## 8 Breakfast Big Breakfast with Hotcakes and Egg Whites (Regular Biscuit)
## 9 Breakfast Big Breakfast with Hotcakes and Egg Whites (Large Biscuit)
## 10 Coffee & Tea Frappé Mocha (Large)
## 11 Coffee & Tea Frappé Caramel (Large)
## 12 Coffee & Tea Frappé Chocolate Chip (Large)
#breakfast items to avoid for weight loss
breakfast%>%
#remove items from breakfast table that are in table g
anti_join(g, by = "Item")%>%
#calculate average calories
summarise(mean(Calories))
## mean(Calories)
## 1 826.6667
#dinner items to avoid for weight maintenance
dinner%>%
#remove items from dinner table that are in table f
anti_join(f, by = "Item")%>%
select(Category,Item)
## Category Item
## 1 Chicken & Fish Chicken McNuggets (20 piece)
## 2 Chicken & Fish Chicken McNuggets (40 piece)
## 3 Smoothies & Shakes Vanilla Shake (Large)
## 4 Smoothies & Shakes Strawberry Shake (Large)
## 5 Smoothies & Shakes Chocolate Shake (Large)
## 6 Smoothies & Shakes Shamrock Shake (Large)
## 7 Smoothies & Shakes McFlurry with M&Mâ\200\231s Candies (Medium)
## 8 Smoothies & Shakes McFlurry with Reese's Peanut Butter Cups (Medium)
#dinner items to avoid for weight maintenance
dinner%>%
#remove items from dinner table that are in table f
anti_join(f, by = "Item")%>%
#calculate average calories
summarise(mean(Calories))
## mean(Calories)
## 1 987.5
#dinner items to avoid for weight loss
dinner%>%
#remove items from dinner table that are in table h
anti_join(h, by = "Item")%>%
select(Category,Item)
## Category Item
## 1 Beef & Pork Double Quarter Pounder with Cheese
## 2 Beef & Pork Bacon Clubhouse Burger
## 3 Chicken & Fish Premium Crispy Chicken Club Sandwich
## 4 Chicken & Fish Bacon Clubhouse Crispy Chicken Sandwich
## 5 Chicken & Fish Premium McWrap Southwest Chicken (Crispy Chicken)
## 6 Chicken & Fish Chicken McNuggets (20 piece)
## 7 Chicken & Fish Chicken McNuggets (40 piece)
## 8 Coffee & Tea Frappé Mocha (Large)
## 9 Coffee & Tea Frappé Caramel (Large)
## 10 Coffee & Tea Frappé Chocolate Chip (Large)
## 11 Smoothies & Shakes Vanilla Shake (Medium)
## 12 Smoothies & Shakes Vanilla Shake (Large)
## 13 Smoothies & Shakes Strawberry Shake (Medium)
## 14 Smoothies & Shakes Strawberry Shake (Large)
## 15 Smoothies & Shakes Chocolate Shake (Medium)
## 16 Smoothies & Shakes Chocolate Shake (Large)
## 17 Smoothies & Shakes Shamrock Shake (Medium)
## 18 Smoothies & Shakes Shamrock Shake (Large)
## 19 Smoothies & Shakes McFlurry with M&Mâ\200\231s Candies (Small)
## 20 Smoothies & Shakes McFlurry with M&Mâ\200\231s Candies (Medium)
## 21 Smoothies & Shakes McFlurry with Oreo Cookies (Medium)
## 22 Smoothies & Shakes McFlurry with Reese's Peanut Butter Cups (Medium)
#dinner items to avoid for weight loss
dinner%>%
#remove items from dinner table that are in table h
anti_join(h, by = "Item")%>%
#calculate average calories
summarise(mean(Calories))
## mean(Calories)
## 1 800.4545
The graphs display the influence of fat and carbohydrates on the calories an item contains. Monitoring fat and carbohydrates is important to controlling weight. Consumers must be aware when reviewing nutritional content that meals like Big Breakfast and Hot Cakes are high in fat and carbohydrates, which lead to higher calories. People sometimes only focus on how many calories an item may have, but it is also important to review the factors affecting those calories.
#create linear model
model <- lm(total_calories ~ total_carbohydrates+total_fat, data = breakfast_menu_calories)
#create tibble ro conduct prediction for linear model
explanatory_data1 <-tibble(
total_carbohydrates = breakfast_menu_calories$total_carbohydrates, total_fat = breakfast_menu_calories$total_fat)
prediction1 <- explanatory_data1 %>%
#Conduct prediction for linear model
mutate(total_calories = predict(model,explanatory_data1))
breakfast_menu_calories%>%
ggplot(aes(x=total_carbohydrates,y = total_calories))+
#Insert linear model in chart
geom_smooth(data = prediction1, method = "lm", se = FALSE, size = 0.8)+
ggtitle("Variable Influence on Calories")+
#select theme
theme_classic()+
xlab("Total Carbohydrates (g) + Total Fat (g)")+
ylab("Total Calories (Kcal)")
## `geom_smooth()` using formula 'y ~ x'
The dinner menu had greater number of available combinations than the breakfast menu, but the breakfast menu had a higher percentage of combinations under 1000 calories. Eighty-seven percent of the menu items in the McDonald’s dataset seem to fit within maintenance and weight loss calorie thresholds for males and females. The four main categories of food in the combo meals were coffee and tea, beverages, chicken and fish, and breakfast. The data suggest that to control calorie intake, it would be better to select chicken or fish options because they offer a person greater combination options compared to meat and pork options. The 20- and 40-piece chicken nugget are an exception because they came up as a food to avoid due their high calorie value. Coffee or tea would a good low-calorie option for a beverage, excluding Frappés. Calorie counting is an important aspect of weight control. However, the linear model demonstrates the importance of people being informed of the other nutritional values in food items. A food item high in calories could be high in nutritional values like carbohydrate and fats.
McDonald’s Corporation. (n.d.). Our History: Ray Kroc & The McDonalds Brothers. https://www.mcdonalds.com/us/en-us/about-us/our-history.html.
McDonald’s Corporation. (2011, June 3). McDonald’s USA Nutrition Facts for Popular Menu It. nutritionfacts.pdf. McDonald’s USA Nutrition Facts for Popular Menu It.
Centers for Disease Control and Prevention. (2021, January 14). FastStats - Body Measurements. Centers for Disease Control and Prevention. https://www.cdc.gov/nchs/fastats/body-measurements.htm.
U.S. Department of Health and Human Services. (n.d.). Body Weight Planner. National Institute of Diabetes and Digestive and Kidney Diseases. https://www.niddk.nih.gov/bwp.
U.S. Department of Health and Human Services. (n.d.). Daily Values (DVs). NIH Office of Dietary Supplements. https://ods.od.nih.gov/HealthInformation/dailyvalues.aspx#:~:text=DVs%20were%20developed%20by%20the,their%20approximate%20requirement%20for%20it.