Group by multiple columns and sum other multiple columns
The dplyr way would be: library(dplyr) df %>% group_by(col1, col2, col3) %>% summarise_each(funs(sum)) You can further specify the columns to be summarised or excluded from the summarise_each by using the special functions mentioned in the help file of ?dplyr::select.