I have a datasets with column year,quarter,Channel,sales,units
df <- structure(list(year = c(2013L, 2013L, 2013L, 2013L, 2013L, 2013L,
you can try this
aggregate(sales~year+quarter+Channel, data=df, FUN = sum) # sum of sale aggregate(units~year+quarter+Channel, data=df, FUN = mean) # mean of units