Wordcloud of top menu items at MSU dining halls from 10/5/18 - 10/15/18

Presidential Chicken

I remember back in undergrad when I visited my friends at Michigan State and they took me to the residential dining hall since they had a meal plan. The cafeteria had typical dorm food like salad bar, burgers, hot dogs, fries etc. Fortunately, the dining halls have improved drastically since then and now the undergraduate students have it great with so many options available to them.

Eat at State

A common theme in the lab is to ask one another what do you have for lunch today? Sometimes we don’t bring anything and our options are to go to the international center food court, the restaurants on Grand River or the residential dining halls. MSU employees have a great option to buy admission into the dining hall at a discounted rate so I always tag along with them so they can swipe me in. We typically preview the menus at eatatstate.msu.edu and will choose to go to the dining hall one with the best menu. One of my favorite dishes from the cafeteria is Presidential Chicken which is a chicken dish with an alfredo like sauce with vegetables and is wrapped up in puff pastry envelope. It tastes great and is exponentially better than the food I’ve had at weddings. We haven’t seen the dish on the menu in well over a year so I decided to see if I could scrape the menus and make a quick shiny dashboard to figure out the next time they would serve it.

Eat at State Shiny Dashboard

Eat at State Shiny Dashboard

library(rvest)
library(knitr)
library(kableExtra)
library(tidyverse)
library(lubridate)

Generate urls

The key to generating a list of URLs for scraping is to identify the patterns of interest and stick them together using the paste() function. Here I used the main eatatstate domain and simply created an object for each dining hall. Then I can use the paste function to link them together so then I have URLs for each dining hall. Then I generated a sequence of dates and appended it to the dining hall URLs.

domain <- "https://eatatstate.msu.edu/menu/"
shaw <- "The%20Vista%20at%20Shaw/all/"
sny_phy <- "The%20Gallery%20at%20Snyder%20Phillips/all/"
landon <- "Heritage%20Commons%20at%20Landon/all/"

dining_halls <- c(shaw, sny_phy, landon)

# List of dates
future_date <- ymd(today()) + days(10)
dates <- seq(ymd(today()), future_date, by = 'day')

# Number of dining halls
dining_hall_no <- length(dining_halls) %>%
  unlist()

# Create lunch urls
day_url <- dining_halls %>% 
  map(~paste(domain, .x, dates, sep = "")) %>%
  unlist()

dining_halls
## [1] "The%20Vista%20at%20Shaw/all/"               
## [2] "The%20Gallery%20at%20Snyder%20Phillips/all/"
## [3] "Heritage%20Commons%20at%20Landon/all/"
dates
##  [1] "2018-10-05" "2018-10-06" "2018-10-07" "2018-10-08" "2018-10-09"
##  [6] "2018-10-10" "2018-10-11" "2018-10-12" "2018-10-13" "2018-10-14"
## [11] "2018-10-15"
day_url %>% 
  head()
## [1] "https://eatatstate.msu.edu/menu/The%20Vista%20at%20Shaw/all/2018-10-05"
## [2] "https://eatatstate.msu.edu/menu/The%20Vista%20at%20Shaw/all/2018-10-06"
## [3] "https://eatatstate.msu.edu/menu/The%20Vista%20at%20Shaw/all/2018-10-07"
## [4] "https://eatatstate.msu.edu/menu/The%20Vista%20at%20Shaw/all/2018-10-08"
## [5] "https://eatatstate.msu.edu/menu/The%20Vista%20at%20Shaw/all/2018-10-09"
## [6] "https://eatatstate.msu.edu/menu/The%20Vista%20at%20Shaw/all/2018-10-10"

Next we will generate the URLs for lunch and dinner and combine them all.

# Create dinner urls
dinner <- "?field_mealtime_target_id=191"

night_url <- dining_halls %>% 
  map(~paste(domain, .x, dates, dinner, sep = "")) %>%
  unlist()

# Combine url list
all_url <- c(day_url, night_url)

all_url %>% 
  head()
## [1] "https://eatatstate.msu.edu/menu/The%20Vista%20at%20Shaw/all/2018-10-05"
## [2] "https://eatatstate.msu.edu/menu/The%20Vista%20at%20Shaw/all/2018-10-06"
## [3] "https://eatatstate.msu.edu/menu/The%20Vista%20at%20Shaw/all/2018-10-07"
## [4] "https://eatatstate.msu.edu/menu/The%20Vista%20at%20Shaw/all/2018-10-08"
## [5] "https://eatatstate.msu.edu/menu/The%20Vista%20at%20Shaw/all/2018-10-09"
## [6] "https://eatatstate.msu.edu/menu/The%20Vista%20at%20Shaw/all/2018-10-10"

Dates and Time

We’ll want to clean up the data with regular expressions and repeat “Lunch” and “Dinner” for the dates and different dining halls.

# Date
date <- rep(dates, times = 2 * dining_hall_no)

# Cafe

no_dates <- length(dates) 
names <- str_replace_all(dining_halls, "%20|\\/all\\/"," ")
cafe <- rep(names, each = no_dates, times = 2)

# Time
time <- rep(c("Lunch", "Dinner"), each = no_dates * dining_hall_no)
time
##  [1] "Lunch"  "Lunch"  "Lunch"  "Lunch"  "Lunch"  "Lunch"  "Lunch" 
##  [8] "Lunch"  "Lunch"  "Lunch"  "Lunch"  "Lunch"  "Lunch"  "Lunch" 
## [15] "Lunch"  "Lunch"  "Lunch"  "Lunch"  "Lunch"  "Lunch"  "Lunch" 
## [22] "Lunch"  "Lunch"  "Lunch"  "Lunch"  "Lunch"  "Lunch"  "Lunch" 
## [29] "Lunch"  "Lunch"  "Lunch"  "Lunch"  "Lunch"  "Dinner" "Dinner"
## [36] "Dinner" "Dinner" "Dinner" "Dinner" "Dinner" "Dinner" "Dinner"
## [43] "Dinner" "Dinner" "Dinner" "Dinner" "Dinner" "Dinner" "Dinner"
## [50] "Dinner" "Dinner" "Dinner" "Dinner" "Dinner" "Dinner" "Dinner"
## [57] "Dinner" "Dinner" "Dinner" "Dinner" "Dinner" "Dinner" "Dinner"
## [64] "Dinner" "Dinner" "Dinner"

Scrape

Here I used the rvest package and combined it with purrr so I read multiple URLs and return the the text so we can put it into a data frame.

# Menu 
menu <- all_url %>%   
 map(~read_html(.x) %>% 
      html_nodes(".meal-title") %>% 
      html_text()) 

Create a data frame

We can bind the data into a data frame so we can easily filter and find menus that we like.

food <- tibble(date, cafe, time, menu) %>% 
  unnest(menu) 

dim(food)
food
## [1] 2349    4
date cafe time menu
2018-10-05 The Vista at Shaw Lunch Chicken Pasta Primavera
2018-10-05 The Vista at Shaw Lunch Corn Muffin
2018-10-05 The Vista at Shaw Lunch Cuban Black Bean and Pork Chili
2018-10-05 The Vista at Shaw Lunch Chocolate Chip Cookie
2018-10-05 The Vista at Shaw Lunch Double Chocolate Chip Cookie
2018-10-05 The Vista at Shaw Lunch M&M Cookie
2018-10-05 The Vista at Shaw Lunch Snickerdoodle Cookie
2018-10-05 The Vista at Shaw Lunch Eggplant Lentil Chili
2018-10-05 The Vista at Shaw Lunch Fruit Bowl
2018-10-05 The Vista at Shaw Lunch Smokey BBQ Tofu Sandwich
2018-10-05 The Vista at Shaw Lunch Steamed Corn
2018-10-05 The Vista at Shaw Lunch Sweet Potato Fries
2018-10-05 The Vista at Shaw Lunch Wild and Jasmine Rice Blend
2018-10-05 The Vista at Shaw Lunch Beef Hot Dog
2018-10-05 The Vista at Shaw Lunch Breaded Chicken Patty
2018-10-05 The Vista at Shaw Lunch Burger Bar
2018-10-05 The Vista at Shaw Lunch French Fries
2018-10-05 The Vista at Shaw Lunch Grilled Cheese
2018-10-05 The Vista at Shaw Lunch Baked Fresh Fish
2018-10-05 The Vista at Shaw Lunch Breadsmith’s Bakery Peasant Roll
2018-10-05 The Vista at Shaw Lunch Honey Butter
2018-10-05 The Vista at Shaw Lunch Orange Mustard Glaze
2018-10-05 The Vista at Shaw Lunch Roasted Red Potatoes
2018-10-05 The Vista at Shaw Lunch Sauteed Capri Vegetables
2018-10-05 The Vista at Shaw Lunch Brown Rice
2018-10-05 The Vista at Shaw Lunch Guinness Lamb Stew
2018-10-05 The Vista at Shaw Lunch Steamed Baby Carrots with Parsley
2018-10-05 The Vista at Shaw Lunch Basmati Rice
2018-10-05 The Vista at Shaw Lunch Crab Rangoons
2018-10-05 The Vista at Shaw Lunch Lo Mein
2018-10-05 The Vista at Shaw Lunch Peking Pork
2018-10-05 The Vista at Shaw Lunch Singapore Broth
2018-10-05 The Vista at Shaw Lunch Tofu
2018-10-06 The Vista at Shaw Lunch Cheese Pizza
2018-10-06 The Vista at Shaw Lunch Chicken Enchilada Soup
2018-10-06 The Vista at Shaw Lunch Pepperoni Pizza
2018-10-06 The Vista at Shaw Lunch Chocolate Chip Cookie
2018-10-06 The Vista at Shaw Lunch Double Chocolate Cookie
2018-10-06 The Vista at Shaw Lunch Snickerdoodle Cookie
2018-10-06 The Vista at Shaw Lunch Fire Roasted Tomato Salsa
2018-10-06 The Vista at Shaw Lunch Roasted Sweet Corn Soup
2018-10-06 The Vista at Shaw Lunch Tortilla Chips
2018-10-06 The Vista at Shaw Lunch Vegan Nacho Casserole
2018-10-06 The Vista at Shaw Lunch Wild and Jasmine Rice Blend
2018-10-06 The Vista at Shaw Lunch Basil Roasted Chicken
2018-10-06 The Vista at Shaw Lunch Breadsmith’s Bakery Peasant Roll
2018-10-06 The Vista at Shaw Lunch Confetti Rice
2018-10-06 The Vista at Shaw Lunch Honey Butter
2018-10-06 The Vista at Shaw Lunch Roasted Lemon Thyme Carrots
2018-10-06 The Vista at Shaw Lunch Pork Pozole
2018-10-06 The Vista at Shaw Lunch Quinoa
2018-10-06 The Vista at Shaw Lunch Sweet and Spicy Brussels Sprouts
2018-10-06 The Vista at Shaw Lunch Beef Shiitake Broth
2018-10-06 The Vista at Shaw Lunch Beef Sirloin Roast
2018-10-06 The Vista at Shaw Lunch Fried Pork Wontons
2018-10-06 The Vista at Shaw Lunch Jasmine Rice
2018-10-06 The Vista at Shaw Lunch Lo Mein
2018-10-06 The Vista at Shaw Lunch Sweet Ginger Sesame Sauce
2018-10-06 The Vista at Shaw Lunch Tofu
2018-10-07 The Vista at Shaw Lunch Beef, Bean and Bacon Soup
2018-10-07 The Vista at Shaw Lunch Cheese Pizza
2018-10-07 The Vista at Shaw Lunch Pepperoni Pizza
2018-10-07 The Vista at Shaw Lunch Chocolate Chip Cookie
2018-10-07 The Vista at Shaw Lunch Double Chocolate Chip Cookie
2018-10-07 The Vista at Shaw Lunch M&M Cookie
2018-10-07 The Vista at Shaw Lunch Steamed Rice
2018-10-07 The Vista at Shaw Lunch Sweet Corn Macaroni and Cheese
2018-10-07 The Vista at Shaw Lunch Sweet Potato Fries
2018-10-07 The Vista at Shaw Lunch Vegan Chicken Tenders
2018-10-07 The Vista at Shaw Lunch Vegetable Minestrone Soup
2018-10-07 The Vista at Shaw Lunch Wild Ruby Rice Blend
2018-10-07 The Vista at Shaw Lunch Breadsmith’s Bakery Peasant Roll
2018-10-07 The Vista at Shaw Lunch Honey Butter
2018-10-07 The Vista at Shaw Lunch Jade Rice Blend
2018-10-07 The Vista at Shaw Lunch Pork Loin with Mushroom Sauce
2018-10-07 The Vista at Shaw Lunch Vegetable of the Day
2018-10-07 The Vista at Shaw Lunch Bourbon Chicken
2018-10-07 The Vista at Shaw Lunch Steamed Broccoli Florets
2018-10-07 The Vista at Shaw Lunch Vegetable Fried Rice
2018-10-07 The Vista at Shaw Lunch Basmati Rice
2018-10-07 The Vista at Shaw Lunch Ginger and Garlic Broth
2018-10-07 The Vista at Shaw Lunch Lo Mein
2018-10-07 The Vista at Shaw Lunch Pork Roast
2018-10-07 The Vista at Shaw Lunch Saigon Sizzle Sauce
2018-10-07 The Vista at Shaw Lunch Tofu
2018-10-07 The Vista at Shaw Lunch Vegetable Egg Rolls
2018-10-08 The Vista at Shaw Lunch Black Bean Chili with Sausage
2018-10-08 The Vista at Shaw Lunch Cheese Stuffed Breadsticks
2018-10-08 The Vista at Shaw Lunch Shrimp and Crab Penne Alfredo
2018-10-08 The Vista at Shaw Lunch Chocolate Chip Cookie
2018-10-08 The Vista at Shaw Lunch Double Chocolate Chip Cookie
2018-10-08 The Vista at Shaw Lunch Oatmeal Raisin Cookie
2018-10-08 The Vista at Shaw Lunch Basmati Rice
2018-10-08 The Vista at Shaw Lunch Garlic Naan Bread
2018-10-08 The Vista at Shaw Lunch Lentil and Garbanzo Curry
2018-10-08 The Vista at Shaw Lunch Steamed Snap Peas and Carrots
2018-10-08 The Vista at Shaw Lunch Vegan White Bean Chick’n Chili
2018-10-08 The Vista at Shaw Lunch Wild Ruby Rice Blend
2018-10-08 The Vista at Shaw Lunch Beef Hot Dog
2018-10-08 The Vista at Shaw Lunch Breaded Chicken Patty
2018-10-08 The Vista at Shaw Lunch Burger Bar
2018-10-08 The Vista at Shaw Lunch French Fries
2018-10-08 The Vista at Shaw Lunch Grilled Cheese
2018-10-08 The Vista at Shaw Lunch Breadsmith’s Bakery Peasant Roll
2018-10-08 The Vista at Shaw Lunch Honey Butter
2018-10-08 The Vista at Shaw Lunch Jerk Pork Loin
2018-10-08 The Vista at Shaw Lunch Roasted Sweet Potatoes
2018-10-08 The Vista at Shaw Lunch Steamed Cauliflower and Carrots
2018-10-08 The Vista at Shaw Lunch Caviar Medley Rice
2018-10-08 The Vista at Shaw Lunch Chili Lime Glaze
2018-10-08 The Vista at Shaw Lunch Roasted Zucchini and Summer Squash
2018-10-08 The Vista at Shaw Lunch Spicy Soy Marinated Chicken Thighs
2018-10-08 The Vista at Shaw Lunch Beef Sirloin Roast
2018-10-08 The Vista at Shaw Lunch Japanese Beef Curry Broth
2018-10-08 The Vista at Shaw Lunch Jasmine Rice
2018-10-08 The Vista at Shaw Lunch Lo Mein
2018-10-08 The Vista at Shaw Lunch Pork Dumplings
2018-10-08 The Vista at Shaw Lunch Spicy Szechuan Sauce
2018-10-08 The Vista at Shaw Lunch Tofu
2018-10-09 The Vista at Shaw Lunch Cheese Stuffed Breadsticks
2018-10-09 The Vista at Shaw Lunch Cheese Tortellini w/ Red Pepper Marinara
2018-10-09 The Vista at Shaw Lunch Chicken Cordon Bleu Soup
2018-10-09 The Vista at Shaw Lunch Chocolate Chip Cookie
2018-10-09 The Vista at Shaw Lunch Double Chocolate Chip Cookie
2018-10-09 The Vista at Shaw Lunch Oatmeal Raisin Cookie
2018-10-09 The Vista at Shaw Lunch Blackened Tofu
2018-10-09 The Vista at Shaw Lunch Cauliflower Salad
2018-10-09 The Vista at Shaw Lunch Fettuccine Pasta
2018-10-09 The Vista at Shaw Lunch Garlic and Herb Spaghetti Sauce
2018-10-09 The Vista at Shaw Lunch Mushroom Barley Soup
2018-10-09 The Vista at Shaw Lunch Roasted Asparagus
2018-10-09 The Vista at Shaw Lunch Sundried Tomato Alfredo Sauce
2018-10-09 The Vista at Shaw Lunch Wild Ruby Rice Blend
2018-10-09 The Vista at Shaw Lunch Beef Hot Dog
2018-10-09 The Vista at Shaw Lunch Breaded Chicken Patty
2018-10-09 The Vista at Shaw Lunch Burger Bar
2018-10-09 The Vista at Shaw Lunch French Fries
2018-10-09 The Vista at Shaw Lunch Grilled Cheese
2018-10-09 The Vista at Shaw Lunch Breadsmith’s Bakery Peasant Roll
2018-10-09 The Vista at Shaw Lunch Buttered Peas and Carrots
2018-10-09 The Vista at Shaw Lunch Cherry Chicken
2018-10-09 The Vista at Shaw Lunch Cherry Pecan Wild Rice
2018-10-09 The Vista at Shaw Lunch Honey Butter
2018-10-09 The Vista at Shaw Lunch Lime Cilantro Yogurt Sauce
2018-10-09 The Vista at Shaw Lunch Steak Fajita Salad
2018-10-09 The Vista at Shaw Lunch Basmati Rice
2018-10-09 The Vista at Shaw Lunch Boneless Skinless Chicken Thighs
2018-10-09 The Vista at Shaw Lunch Lo Mein
2018-10-09 The Vista at Shaw Lunch Mushroom Broth
2018-10-09 The Vista at Shaw Lunch Thai Peanut Sauce
2018-10-09 The Vista at Shaw Lunch Thai Vegetable Potstickers
2018-10-09 The Vista at Shaw Lunch Tofu
2018-10-10 The Vista at Shaw Lunch Breadsticks
2018-10-10 The Vista at Shaw Lunch Buffalo Chicken Pasta
2018-10-10 The Vista at Shaw Lunch Lentil and Chorizo Soup
2018-10-10 The Vista at Shaw Lunch Chocolate Chip Cookie
2018-10-10 The Vista at Shaw Lunch Double Chocolate Chip Cookie
2018-10-10 The Vista at Shaw Lunch Sugar Cookie
2018-10-10 The Vista at Shaw Lunch French Fries
2018-10-10 The Vista at Shaw Lunch Roasted Red Pepper Aioli
2018-10-10 The Vista at Shaw Lunch Steamed Mixed Vegetables
2018-10-10 The Vista at Shaw Lunch Tomato Basil Soup
2018-10-10 The Vista at Shaw Lunch Vegan Chick’n Sandwich
2018-10-10 The Vista at Shaw Lunch Wild Ruby Rice Blend
2018-10-10 The Vista at Shaw Lunch Beef Hot Dog
2018-10-10 The Vista at Shaw Lunch Breaded Chicken Patty
2018-10-10 The Vista at Shaw Lunch Burger Bar
2018-10-10 The Vista at Shaw Lunch French Fries
2018-10-10 The Vista at Shaw Lunch Grilled Cheese
2018-10-10 The Vista at Shaw Lunch Breadsmith’s Bakery Peasant Roll
2018-10-10 The Vista at Shaw Lunch Chicken Pasta Primavera
2018-10-10 The Vista at Shaw Lunch Honey Butter
2018-10-10 The Vista at Shaw Lunch Roasted Zucchini and Summer Squash
2018-10-10 The Vista at Shaw Lunch Cilantro Lime Rice
2018-10-10 The Vista at Shaw Lunch Coleslaw
2018-10-10 The Vista at Shaw Lunch Roasted Fajita Vegetables
2018-10-10 The Vista at Shaw Lunch Tortilla Encrusted Fresh Fish
2018-10-10 The Vista at Shaw Lunch Crab Rangoons
2018-10-10 The Vista at Shaw Lunch Jasmine Rice
2018-10-10 The Vista at Shaw Lunch Lo Mein
2018-10-10 The Vista at Shaw Lunch Miso Broth
2018-10-10 The Vista at Shaw Lunch Pork Roast
2018-10-10 The Vista at Shaw Lunch Sweet Onion Teriyaki Sauce
2018-10-10 The Vista at Shaw Lunch Tofu
2018-10-11 The Vista at Shaw Lunch Brick Oven Chicken Pot Pie
2018-10-11 The Vista at Shaw Lunch Spicy Steak Chili
2018-10-11 The Vista at Shaw Lunch Chocolate Chip Cookie
2018-10-11 The Vista at Shaw Lunch Double Chocolate Chip Cookie
2018-10-11 The Vista at Shaw Lunch Sugar Cookie
2018-10-11 The Vista at Shaw Lunch Apple Snicker Bar Salad
2018-10-11 The Vista at Shaw Lunch Breadsticks
2018-10-11 The Vista at Shaw Lunch Cheese Tortellini with Alfredo
2018-10-11 The Vista at Shaw Lunch Italian Vegetable Saute
2018-10-11 The Vista at Shaw Lunch Onion Soup
2018-10-11 The Vista at Shaw Lunch Roasted Red Pepper Marinara
2018-10-11 The Vista at Shaw Lunch Spaghetti Noodles
2018-10-11 The Vista at Shaw Lunch Wild Ruby Rice Blend
2018-10-11 The Vista at Shaw Lunch Beef Hot Dog
2018-10-11 The Vista at Shaw Lunch Breaded Chicken Patty
2018-10-11 The Vista at Shaw Lunch Burger Bar
2018-10-11 The Vista at Shaw Lunch French Fries
2018-10-11 The Vista at Shaw Lunch Grilled Cheese
2018-10-11 The Vista at Shaw Lunch Beef and Noodles
2018-10-11 The Vista at Shaw Lunch Breadsmith’s Bakery Peasant Roll
2018-10-11 The Vista at Shaw Lunch Honey Butter
2018-10-11 The Vista at Shaw Lunch Steamed Broccoli and Cauliflower
2018-10-11 The Vista at Shaw Lunch Garlic Buttered Rice
2018-10-11 The Vista at Shaw Lunch Roasted Ginger Curry Carrots
2018-10-11 The Vista at Shaw Lunch Tandoori Chicken
2018-10-11 The Vista at Shaw Lunch Asian Pineapple Sauce
2018-10-11 The Vista at Shaw Lunch Basmati Rice
2018-10-11 The Vista at Shaw Lunch Crab Meat
2018-10-11 The Vista at Shaw Lunch Lo Mein
2018-10-11 The Vista at Shaw Lunch Pork Wonton
2018-10-11 The Vista at Shaw Lunch Seafood and Bok Choy Broth
2018-10-11 The Vista at Shaw Lunch Shrimp
2018-10-11 The Vista at Shaw Lunch Tofu
2018-10-12 The Vista at Shaw Lunch Garlic Breadsticks
2018-10-12 The Vista at Shaw Lunch Macaroni and Cheese
2018-10-12 The Vista at Shaw Lunch Pepper Jack Crab Soup
2018-10-12 The Vista at Shaw Lunch Chocolate Chip Cookie
2018-10-12 The Vista at Shaw Lunch Double Chocolate Chip Cookie
2018-10-12 The Vista at Shaw Lunch M&M Cookie
2018-10-12 The Vista at Shaw Lunch Anaheim Chili Soup
2018-10-12 The Vista at Shaw Lunch Apple Baked Beans
2018-10-12 The Vista at Shaw Lunch Broccoli Pasta Salad
2018-10-12 The Vista at Shaw Lunch Corn Fritters
2018-10-12 The Vista at Shaw Lunch Vegan BBQ Beef Tips
2018-10-12 The Vista at Shaw Lunch Wild Ruby Rice Blend
2018-10-12 The Vista at Shaw Lunch Beef Hot Dog
2018-10-12 The Vista at Shaw Lunch Breaded Chicken Patty
2018-10-12 The Vista at Shaw Lunch Burger Bar
2018-10-12 The Vista at Shaw Lunch French Fries
2018-10-12 The Vista at Shaw Lunch Grilled Cheese
2018-10-12 The Vista at Shaw Lunch Breadsmith’s Bakery Peasant Roll
2018-10-12 The Vista at Shaw Lunch Fresh Fish with Garlic Herb Butter
2018-10-12 The Vista at Shaw Lunch Honey Butter
2018-10-12 The Vista at Shaw Lunch Roasted Root Vegetables
2018-10-12 The Vista at Shaw Lunch Steamed Rice
2018-10-12 The Vista at Shaw Lunch Sauteed Bok Choy
2018-10-12 The Vista at Shaw Lunch Sesame Brown Rice
2018-10-12 The Vista at Shaw Lunch Sesame Chili Crusted Chicken
2018-10-12 The Vista at Shaw Lunch Stir Fry Sauce
2018-10-12 The Vista at Shaw Lunch Bangkok Pork Broth
2018-10-12 The Vista at Shaw Lunch Duck Potstickers
2018-10-12 The Vista at Shaw Lunch Jasmine Rice
2018-10-12 The Vista at Shaw Lunch Lo Mein
2018-10-12 The Vista at Shaw Lunch Orange Citrus Sauce
2018-10-12 The Vista at Shaw Lunch Pork Roast
2018-10-12 The Vista at Shaw Lunch Tofu
2018-10-05 The Gallery at Snyder Phillips Lunch Chocolate Chip Cookie
2018-10-05 The Gallery at Snyder Phillips Lunch Chocolate Peanut Butter Marble Cake
2018-10-05 The Gallery at Snyder Phillips Lunch Iced Brownie
2018-10-05 The Gallery at Snyder Phillips Lunch Snickerdoodle Cookie
2018-10-05 The Gallery at Snyder Phillips Lunch Vegan Chocolate Cake
2018-10-05 The Gallery at Snyder Phillips Lunch Battered Haddock
2018-10-05 The Gallery at Snyder Phillips Lunch Beyond Meat Vegan Burger
2018-10-05 The Gallery at Snyder Phillips Lunch Breaded Chicken Patty
2018-10-05 The Gallery at Snyder Phillips Lunch Burger
2018-10-05 The Gallery at Snyder Phillips Lunch Cheeseburger
2018-10-05 The Gallery at Snyder Phillips Lunch Chef’s Choice
2018-10-05 The Gallery at Snyder Phillips Lunch Chipotle Mayonnaise
2018-10-05 The Gallery at Snyder Phillips Lunch Dill Pickle Chips
2018-10-05 The Gallery at Snyder Phillips Lunch French Fries
2018-10-05 The Gallery at Snyder Phillips Lunch Grilled Cheese
2018-10-05 The Gallery at Snyder Phillips Lunch Grilled Chicken Breast
2018-10-05 The Gallery at Snyder Phillips Lunch Iceberg Lettuce
2018-10-05 The Gallery at Snyder Phillips Lunch Lemons
2018-10-05 The Gallery at Snyder Phillips Lunch Mayonnaise
2018-10-05 The Gallery at Snyder Phillips Lunch Mustard
2018-10-05 The Gallery at Snyder Phillips Lunch Red Onions
2018-10-05 The Gallery at Snyder Phillips Lunch Sweet Baby Ray’s BBQ Sauce
2018-10-05 The Gallery at Snyder Phillips Lunch Tartar Sauce
2018-10-05 The Gallery at Snyder Phillips Lunch Tomatoes
2018-10-05 The Gallery at Snyder Phillips Lunch Bacon
2018-10-05 The Gallery at Snyder Phillips Lunch Battered Haddock
2018-10-05 The Gallery at Snyder Phillips Lunch Beanless Chili
2018-10-05 The Gallery at Snyder Phillips Lunch Cheddar Cheese
2018-10-05 The Gallery at Snyder Phillips Lunch Cheese Sauce
2018-10-05 The Gallery at Snyder Phillips Lunch French Fries
2018-10-05 The Gallery at Snyder Phillips Lunch Mushrooms
2018-10-05 The Gallery at Snyder Phillips Lunch Pepper Jack Cheese
2018-10-05 The Gallery at Snyder Phillips Lunch Philly Beef Sandwich
2018-10-05 The Gallery at Snyder Phillips Lunch Provolone Cheese
2018-10-05 The Gallery at Snyder Phillips Lunch Sauteed Bell Peppers and Onions
2018-10-05 The Gallery at Snyder Phillips Lunch Swiss Cheese
2018-10-05 The Gallery at Snyder Phillips Lunch Caramel Apple Pizza
2018-10-05 The Gallery at Snyder Phillips Lunch Cheese Pizza
2018-10-05 The Gallery at Snyder Phillips Lunch Pepperoni Pizza
2018-10-05 The Gallery at Snyder Phillips Lunch Farro
2018-10-05 The Gallery at Snyder Phillips Lunch Fattoush Salad
2018-10-05 The Gallery at Snyder Phillips Lunch Jasmine Rice
2018-10-05 The Gallery at Snyder Phillips Lunch Steamed Peas
2018-10-05 The Gallery at Snyder Phillips Lunch Teriyaki Tofu and Vegetable Yakitori
2018-10-05 The Gallery at Snyder Phillips Lunch Vegan French Onion Soup
2018-10-05 The Gallery at Snyder Phillips Lunch Woody’s Garlic Scallion Hummus
2018-10-05 The Gallery at Snyder Phillips Lunch Woody’s Original Hummus
2018-10-05 The Gallery at Snyder Phillips Lunch Woody’s Tabbouleh Salad
2018-10-05 The Gallery at Snyder Phillips Lunch Woody’s Thin Pita Bread
2018-10-05 The Gallery at Snyder Phillips Lunch Corn O’Brien

I made it on Monday this week and to my surprise I saw that they would be serving it today for dinner in Landon!

food %>% 
  filter(str_detect(menu, "Presidential"))
## # A tibble: 1 x 4
##   date       cafe                       time   menu                
##   <date>     <chr>                      <chr>  <chr>               
## 1 2018-10-05 Heritage Commons at Landon Dinner Presidential Chicken

We can also filter to look at the menu for today only.

food %>% 
  filter(date == today())
## # A tibble: 288 x 4
##    date       cafe              time  menu                           
##    <date>     <chr>             <chr> <chr>                          
##  1 2018-10-05 The Vista at Shaw Lunch Chicken Pasta Primavera        
##  2 2018-10-05 The Vista at Shaw Lunch Corn Muffin                    
##  3 2018-10-05 The Vista at Shaw Lunch Cuban Black Bean and Pork Chili
##  4 2018-10-05 The Vista at Shaw Lunch Chocolate Chip Cookie          
##  5 2018-10-05 The Vista at Shaw Lunch Double Chocolate Chip Cookie   
##  6 2018-10-05 The Vista at Shaw Lunch M&M Cookie                     
##  7 2018-10-05 The Vista at Shaw Lunch Snickerdoodle Cookie           
##  8 2018-10-05 The Vista at Shaw Lunch Eggplant Lentil Chili          
##  9 2018-10-05 The Vista at Shaw Lunch Fruit Bowl                     
## 10 2018-10-05 The Vista at Shaw Lunch Smokey BBQ Tofu Sandwich       
## # ... with 278 more rows

Wordcloud

Since we have a tidy data frame of all the dining halls we can use the tidytext package from Julia Silge and David Robinson to tokenize the menu and make a word cloud. First I used the palette from MSU’s website and set it as an object pal. Next we will unnest the tokens from the food data frame and count up the most frequent words. We can remove filler words with an anti_join() command and then tell R to create a wordcloud!

library(tidytext)
library(wordcloud)
library(RColorBrewer)

# MSU palette colors  
pal <- c("#97A2A2","#F08521","#6E005F","#F08521","#97A2A2","#0DB14B")

set.seed(1234)

food %>% 
  unnest_tokens(menu, menu) %>% 
  count(menu, sort = TRUE) %>% 
  rename(word = menu) %>% 
  anti_join(stop_words, by = "word") %>% 
  with(wordcloud(word, n, random.order = FALSE, max.words = 40, color = pal,fixed.asp = TRUE))

Shiny Dashboard

Now that we learned how to make a wordcloud, scrape the menu into a tidy data frame we can work on making a interact with the data by making a shiny dashboard.

library(shiny)
library(shinydashboard)

ui <- dashboardPage(skin = "green",
  dashboardHeader(title = "Eat at State"),
  dashboardSidebar( selectInput(inputId = 'dininghall',
                  label = 'Choose Dining Hall:',
                  choices = c("All","The Vista at Shaw ",
                              "The Gallery at Snyder Phillips ",
                              "Heritage Commons at Landon "))
  ),
  
  dashboardBody(
    # Boxes need to be put in a row (or column)
    fluidRow(
      box(dataTableOutput("menu"),title = "MSU Dining Menu",
          width = 12, status = "primary")
      )
    )
  )

server <- function(input, output) {
  
   menu <- reactive({
    if(input$dininghall == "All")
        return(food)
    else
      food %>% 
       filter(cafe %in% input$dininghall)
  })

  output$menu <- renderDataTable(menu())
}

shinyApp(ui, server)
Eat at State Shiny Dashboard

Eat at State Shiny Dashboard

Presidential Chicken!

Landon I had the idea to scrape for presidential chicken on Monday this week and I was thrilled that Landon had it for dinner on Friday. Now that I was able to go I decided to create this blog post to share with everyone!

Related

comments powered by Disqus