Session Ready
Exercise

Making Graphs of Different User Types

Let's compare graphs of people who subscribe to the divvy bike vs. more casual non-subscribing customers.

It's convenient to use dplyr to manipulate the data before using graph_from_data_frame() to create the graph. One useful dplyr function you'll need is n(), which gives the number of rows in that group of the data frame.

Instructions 1/3
undefined XP
  • 1
    • Filter bike_dat for rows where usertype is "Subscriber".
    • Count the number of rows in subscribers.
    • Group subscribers by from_station_id and to_station_id.
    • Inside summarize(), calculate weights as the number of trips in the group, n() divided by the total number of trips by subscribers.
    • Use graph_from_data_frame() to make a graph.
    • 2
      • Filter bike_dat for usertype "Customer".
      • Count the number of subscriber trips.
      • Group subscribers by pairs of from/to stations.
      • Calculate weights as the proportion of total trips.
      • Make a graph from the data frame.
    • 3
      • Count the number of different trips (pairs of from/to stations) by subscribers.
      • Do the same for customers.