powered by
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 single integer giving the index of the match in A.
A
A vector which may have a single match in B.
B
A vector of possible matches for A.
a character string: error message if no match found.
a character string: error message if multiple matches found.
Spencer Graves
interpPairs
a2b <- whichAeqB(letters, 'b') stopifnot( all.equal(a2b, 2) )
Run the code above in your browser using DataLab