Below is the simplified example of my data, the column new is the one I want to add to the dataset. Basically, I want to rename the riskset using 1,2,3,4... so that it'll be easier for me to do loops. The numbers in riskset have been sorted, they are not continuous and there are duplicate numbers in the riskset (10~11 for each unique number), so how to add another column grouping the observations based on their riskset number?
  riskset            new
a.0000000017          1
a.0000000017          1
a.0000000017          1
a.0000000017          1
a.0000000066          2
a.0000000066          2
a.0000000066          2
a.0000000066          2
a.0000000099          3
a.0000000099          3
a.0000000099          3
a.0000000099          3
a.0000000099          3
              ......