I have a data set that looks like this:
Num Flavor
1 Chocolate
2 Chocolate
3 Chocolate
4 Strawberry
5 Strawberry
6 Vanilla
7 Chocolate
My goal is to create a column which counts the number of times each unique value is present in the data, next to the variable which it is counting, like this:
Num Cnt Flavor
1 1 Chocolate
2 2 Chocolate
3 3 Chocolate
4 1 Strawberry
5 2 Strawberry
6 1 Vanilla
7 4 Chocolate
And so forth.