I am trying to use dplyr or data.table to calculate sums, percentages, counts, and weighted means for various sub groups.

Each Name can have subgroups High Medium and low, and potentially others, and there are many observations for each name. For each name, i want to calculate the count of highs, mediums, lows; the sums of highs, mediums, and lows, the % of total distribution to high/medium/low; the weighted mean price of each rating category for each name, and the mode of type (most commonly occurring).

Hopefully not too confusing but i have attached a screenshot of sample data. Ultimately it is a few hundred thousand rows of data with observations in the rows and variables in columns. Any input is greatly appreciated! enter image description here



Browse other questions tagged or ask your own question.