Aan de slagGa gratis aan de slag

Computing stats by groups (I)

So far you have worked with the two dimensions, rows and columns of a data.table. It's now time to consider the virtual third dimension by dividing rows into groups to calculate statistics.

Deze oefening maakt deel uit van de cursus

Data Manipulation with data.table in R

Cursus bekijken

Oefeninstructies

Compute the mean duration for every start_station, calling the aggregated column mean_duration.

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# Compute the mean duration for every start_station
mean_start_stn <- batrips[, .(___), by = ___]
mean_start_stn
Code bewerken en uitvoeren