How to sum a variable by group
Using aggregate: aggregate(x$Frequency, by=list(Category=x$Category), FUN=sum) Category x 1 First 30 2 Second 5 3 Third 34 In the example above, multiple dimensions can be specified in the list. Multiple aggregated metrics of the same data type can be incorporated via cbind: aggregate(cbind(x$Frequency, x$Metric2, x$Metric3) … (embedding @thelatemail comment), aggregate has a formula interface too aggregate(Frequency … Read more