Exercise

Computing stats by groups (II)

When grouping a data.table by multiple columns, you need to specify the by argument as either a character vector or a list. In this exercise, you will calculate the mean of duration for:

  • Each unique combination of start_station and end_station
  • Each start_station for each month

Instructions 1/2

undefined XP
  • 1

    Compute the mean duration for each unique combination start_station and end_station. Call the aggregated column mean_duration.

  • 2

    Compute the mean duration for each start_station and for each month in start_date. Call the aggregated column mean_duration.