I have dataset like this:
Value
5
4
2
1
I want the largest value to have the smallest rank while the lowest value to have the highest rank. In this dataset, Value=1 will recode to 5 while Value=5 will recode to 1. However, due to the missing Value=3 in my dataset, by using the rank function rank(-Value), I only managed to get this
Value Rank
5 1
4 2
2 3
1 4
Is there any way in R to get something like this?
Value Rank
5 1
4 2
2 4
1 5