Add more explanation on the use of the aggregate function. Made sure that the stats package is loaded.