Find positions of Matching Elements between Vectors in R Programming – match() Function
match() function in R Language is used to return the positions of the first match of the elements of the first vector in the second vector. If the element is not found, it returns NA.
Syntax: match(x1, x2, nomatch)
x1: Vector 1
x2: Vector 2
nomatch: value to be returned in case of no match
 4 NA NA 1 5
 4 -1 -1 1 5