which
and %in%
would probably be good for this task, or match
depending on what you are going for. A point to note is that match
returns the index of the first match of it's first argument in it's second argument (that is to say if you have multiple values in the lookup table only the first match to that will be returned):
set.seed(123)
# I am assuming these are the values you want to check if they are in the lookup 'table'
list2 <- sample( letters[1:10] , 10 , repl = T )
[1] "c" "h" "e" "i" "j" "a" "f" "i" "f" "e"
# I am assuming this is the lookup table
list1 <- letters[1:3]
[1] "a" "b" "c"
# Find which position in the lookup table each value is, NA if no match
match(list2 , list1 )
[1] 3 NA NA NA NA 1 NA NA NA NA