Apologies, if this is a duplicate please let me know, I'll gladly delete.
I am attempting to select the four highest values for different values of another column.
Dataset:
A COUNT
1 1 2
2 1 6
3 1 3
4 1 9
5 1 2
6 1 7
7 1 0
8 1 5
9 1 2
10 1 7
11 2 5
12 2 1
13 2 8
14 2 9
15 2 5
16 2 2
17 2 2
18 2 4
19 3 7
20 3 5
21 3 2
22 3 8
23 3 6
24 3 1
25 3 9
26 3 5
27 4 8
28 4 1
29 4 1
30 4 3
31 4 9
For example, I would like to select four highest values when A=1 (9,7,7,6) then when A=2 (9,8,5,5) and so on...
I have looked a various answers on 'selecting highest values' but was struggling to find an example conditioning on another column.
Many thanks