load(url("https://github.com/vsass/CSSS508/raw/main/Lectures/Lecture7/data/restaurants.Rdata"))
Homework 7
Key
Click link above for answers to homework 7.
Instructions
Answer each of the following questions. Be sure to display all your code in the rendered version (use echo: true
throughout1).
Use the following code to read in the King County restaurants data:
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.
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
Question 4 (OPTIONAL):
Separate the variable Phone
into three variables that only contain numerical digits: area_code
, first_3
, and last_4
.
Due Dates
# | Homework Due | Peer Review Due |
---|---|---|
1 | 2 April | 7 April |
2 | 9 April | 14 April |
3 | 16 April | 21 April |
4 | 23 April | 28 April |
5 | 30 April | 5 May |
6 | 7 May | 12 May |
7 | 14 May | 19 May |
8 | 21 May | 26 May |
9 | 28 May | 2 June |
Footnotes
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 ---
Anything that is separated by spaces counts as a word for this problem.↩︎
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.↩︎
There are a few ways to do this. Use the method that makes most sense to you!↩︎