For this, we will use the function aggregate, which can be used as follows:
aggregate(formula,function,data)
The following code shows various ways of using the aggregate function.
CODE:
df = data.frame(group=c("Group 1","Group 1","Group 2","Group 2",&quo...