Sometimes, we wish to split data into subsets and apply a function such as the mean, max, or min to each subset. In R, we can do this through the aggregate or tapply functions.
Here, we have a dataset of statistics on the top five strikers of the four clubs that made it to the semi-final of the European Champions League Football tournament in 2014. We will use it to illustrate aggregation in R and its equivalent GroupBy functionality in pandas.