Skip to content

Using Match in a lookup table

4 messages · Michael Pearmain, David Winsemius

#
On Jun 28, 2011, at 6:18 AM, Michael Pearmain wrote:

            
A numeric vector.
Not possibly a numeric vector.
You need to keep track of the successful matches in df1 and then ypu  
probably want to interleave them with matches in df2. Perhaps instead  
use ifelse to do the work for you:

 > ifelse(!is.na(match(v,df1$name)), match(v,df1$name),  
match(v,df2$name2) )
[1] 1 1 2 2 1
David Winsemius, MD
West Hartford, CT