This is my data:
ID dist
1 23
1 10
2 12
2 20
3 14
3 33
I want to go through each ID, and create a new column ("state") for the larger value for each ID call it "high" and for the lower value, call it "low".
What's the best way to do this?