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
Este exercício faz parte do curso
Data Manipulation with data.table in R
Exercício interativo prático
Experimente este exercício completando este código de exemplo.
# Compute the mean duration for every start and end station
mean_station <- batrips[, ___, ___ = .(___, ___)]
mean_station