Index of a single match
Return which(A %in% B) if it has length 1; give an error message otherwise.
whichAeqB(A, B, errNoMatch='no match', err2Match='more than one match')
A |
A vector which may have a single match in |
B |
A vector of possible matches for |
errNoMatch |
a character string: error message if no match found. |
err2Match |
a character string: error message if multiple matches found. |
a single integer giving the index of the match in A
.
Spencer Graves
a2b <- whichAeqB(letters, 'b') all.equal(a2b, 2)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.