Homework 7

Instructions

Answer each of the following questions. Be sure to display all your code in the rendered version (use echo: true throughout1).

1 You can make this a global option for your whole document by putting it directly in the YAML of your qmd:

---
title: "My Document"
execute:
  echo: true
---

Use the following code to read in the King County restaurants data:

load(url("https://github.com/vsass/CSSS508/raw/main/Lectures/Lecture7/data/restaurants.Rdata"))

Exercises

Question 1:

What is the shortest restaurant name? What is the longest restaurant name?

Question 2:

Read the documentation for separate_longer_delim(). Use this function to figure out what 10 “words”2 are most frequently used for the restaurant names in this data set.

2 Anything that is separated by spaces counts as a word for this problem.

Question 3:

Which zip code has the highest (meaning worst) mean Grade?3 For that worst-rated zip code, how has its average rating changed by year?4

3 Note: To accurately reflect the true average you’ll want to weight this by restaurant: i.e. get the average grade by restaurant first, then get the average of those averages by zip code.

4 There are a few ways to do this. Use the method that makes most sense to you!

Question 4 (OPTIONAL):

Separate the variable Phone into three variables that only contain numerical digits: area_code, first_3, and last_4.

Before you submit:

Have you remembered to add embed-resources: true to your YAML?

Due Dates

# Homework Due Peer Review Due
1 7 October 12 October
2 14 October 19 October
3 21 October 26 October
4 28 October 2 November
5 11 November 16 November
6 18 November 21 November
7 25 November 30 November
8 2 December 7 December
9 9 December 14 December