LoslegenKostenlos loslegen

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

Diese Übung ist Teil des Kurses

Data Manipulation with data.table in R

Kurs anzeigen

Interaktive Übung

Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.

# Compute the mean duration for every start and end station
mean_station <- batrips[, ___, ___ = .(___, ___)]
mean_station
Code bearbeiten und ausführen