
Jami H.
asked 11/06/20How do I create a new dataset when I need to add new variables?
5b. Time Series Average by Month and Year
You'll need to do a little data prep for this one:
- First figure out the top 5 reviewed coffee shops (by number of reviews ~ hint frequency of coffee_shop_name)
- Create a new dataset for containing those 5 shops, review month and year(numeric?), and the mean num_rating and mean vibe_sent
- The result should look something like this
Month_Year Coffee Shop Mean Rating Mean Vibe Sent
----------- ------------ ------------ ----------------
Jan 2017 Mike's Coffee 4.5 4.3
This is what I tried so far and I'm getting errors:
```{r}
yelp_prep %>%
count(coffee_shop_name)
top_five_coffee <-yelp_prep %>%
filter(coffe_shop_name=="The factory - Cafe with a Soul","Halcyon","Epoch Coffee", "Caffee Medici", "Houndstooth Coffee")
1 Expert Answer

Muhammad R. answered 02/08/21
ISU Grad For Statistics, R and ArcGIS Tutoring
Top 5 Coffee shops:
data %>%
group_by (coffee_shop_name) %>%
summarize(N = n()) %>%
top_n(5)
Create a new dataset for containing those 5 shops:
data %>%
filter(coffee_shop_name %in% c("1st coffee shop", "2nd coffee shop", "3rd coffee shop", "4th coffee
shop", "5th coffee shop")) %>%
group_by(Month_Year, coffee_shop_name) %>%
summarize(Mean_Rating = mean(rating column),
Mean_Vibe_Sent = mean(vibes sent column))
Still looking for help? Get the right answer, fast.
Get a free answer to a quick problem.
Most questions answered within 4 hours.
OR
Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.
Bobosharif S.
Hi, where is your data? You have to arrange data be review, say asc, then just select the top 5,11/12/20