Adding columns by group
Recall that you can perform computations by group using the by argument of the data.table. In this exercise, you will add new columns by group to the original data.table by reference.
This exercise is part of the course
Data Manipulation with data.table in R
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Add a new column equal to total trips for every start station
batrips[, ___, by = ___]