Using more by parameters, e. g. aggregate(products$price, by=list(products$name, products$brand), FUN=mean)
. Now products are separated by brands and the mean value will be calculated by each product and brand, e. g. Jeans Calvin Klein, Jeans Esprit, Jeans Pepe Jeans