I have a dataframes that is a bootstrapped sample. This means some IDs have been repeated. Each dataframe contains 3 columns: ID, YEAR, Short_Rating.
My subsequent code requires the IDs to be unique. I need to rename the IDs and make them unique. For example I will have the following dataframe:
ID YEAR Short_Rating
4205 1996 1
4205 1997 2
4205 1998 5
4205 1999 2
2356 1996 3
2356 1997 4
2356 1998 1
2356 1999 2
4205 1996 1
4205 1997 2
4205 1998 5
4205 1999 2
I want it to rename the IDs in the ID column to:
ID YEAR Short_Rating
1 1996 1
1 1997 2
1 1998 5
1 1999 2
2 1996 3
2 1997 4
2 1998 1
2 1999 2
3 1996 1
3 1997 2
3 1998 5
3 1999 2
Each ID will always consist of the same number of years.