Suppose I have the dataset
| ID | Country | Sales |
|---|---|---|
| 1 | Austria | 6 |
| 1 | Austria | 6 |
| 1 | Belgium | 6 |
| 2 | Belgium | 10 |
| 2 | Czech | 10 |
| 3 | Denmark | 3 |
| 3 | Germany | 3 |
I want to another variable of sales which depends on countries and their ID ie in fractions.
| ID | Country | Sales | fraction |
|---|---|---|---|
| 1 | Austria | 6 | 0.666 |
| 1 | Austria | 6 | 0.666 |
| 1 | Belgium | 6 | 0.333 |
| 2 | Belgium | 10 | 0.5 |
| 2 | Czech | 10 | 0.5 |
| 3 | Denmark | 3 | 1 |
| 3 | Denmark | 3 | 1 |
Any help would be appreciated!