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
andend_station
- Each
start_station
for each month
This exercise is part of the course
Data Manipulation with data.table in R
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Compute the mean duration for every start and end station
mean_station <- batrips[, ___, ___ = .(___, ___)]
mean_station