LoslegenKostenlos loslegen

Updating columns by group

You often need to create new intermediate columns to get to the final result but don't necessarily need these intermediate columns in the final result. This is a very common pattern in data analysis.

In this exercise, you will work with a new data.table, batrips_new, which is almost identical to batrips, except we randomly introduced some missing values in the duration column.

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.

# Calculate the mean duration for each month
batrips_new[, ___, 
            by = month(start_date)]
Code bearbeiten und ausführen