Hi @SF_Crisis! Since your question seems related to an educational assigment, I'll try to avoid providing you a complete solution, but rather a hint:
The aggregate function has an argument (by) that takes the values of the variable you are using to group the data. These values have to be provided as a list (for example, by = list(grouping_variable)). You may find some additional help here.