Social Media Research

02 R Data Analysis


Question

How can you add more columns of a data.frame to the aggregate function?


Answer

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




Comments