I have the following two vectors:
a<-c(1,4,6,5,5,2,4,6,1)
b<-c(0.5,1,1.5,2,2.5,3)
I want to replace each element in vector a with the element in b with the index given by the element in a. The resulting vector in this example should be:
c(0.5,2,3,2.5,2.5,1,2,3,0.5)