I would guess this is a duplicate, but I can’t find that so here goes…
I’d like to return the index of second in first:
first = c( "a" , "c" , "b" )
second = c( "c" , "b" , "a" )
result = c( 2 , 3 , 1 )
I guarantee that first and second have unique values, and the same values between the two.
Getting indexes of values is what
match()is for.