MulaiMulai sekarang secara gratis

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

Latihan ini adalah bagian dari kursus

Data Manipulation with data.table in R

Lihat Kursus

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

# Compute the mean duration for every start and end station
mean_station <- batrips[, ___, ___ = .(___, ___)]
mean_station
Edit dan Jalankan Kode