I would like to change a vector of integers into their order of appearance.
Suppose I have this vector:
c(3, 2, 3, 4, 4, 5, 5, 2, 1)
The integer 3 appears first, so it should be 1.
The integer 2 appears second, so it should be 2. And so on.
The desired outcome:
1 2 1 3 3 4 4 2 6