I have 2 columns of data. The first one is an id and the second one a value. There may be many occurrences of the same id. I need to aggregate the data by summing all the values for the same id AND I would like to create a new column with the number of occurrences of the same id.
For example:
id  value
1   15
1   10
2   5
3   7
1   4
3   12
4   16
I know I can use aggregate to sum the values and reduce the table to 4 rows, but I would like an extra column with the number of occurrences of the id like this:
id   value   freq
1     29      3
2      5      1
3     19      2
4     16      1
Thank you
 
     
    