1. Learn
  2. /
  3. Courses
  4. /
  5. Visualizing Big Data with Trelliscope in R

Exercise

Faceting daily rides

We noticed some interesting behavior when we looked at daily ride counts faceted by day-of-week. Let's investigate whether faceting on additional variables yields any new insights. Here we will see if there are different day-of-week patterns when also looking at the payment types of cash or credit card.

tx is available for you in your workspace.

Instructions

100 XP
  • After filtering to just cash and credit transactions, create a summary by day of week and payment type count using dplyr, grouping by the pickup_date, pickup_dow, payment_type.
  • Inside summarise(), count the number of rides and assign the result to a new variable n_rides.
  • Plot the result using the daily_count summary dataset as an input to ggplot() and using geom_point(), with pickup_date on the x-axis and n_rides on the y-axis.
  • Use facet_grid() to facet with payment_type as rows and day of week pickup_dow as columns.
  • Note that the coord_fixed() code constrains the aspect ratio of the resulting plot to help highlight patterns visually.