In R, how is data aggregated?

It is simple to collapse data in R using one or more BY variables. The BY variable should be in the list when using the aggregate() method.