use aggregate() for mean
use aggregate to calculate mean