My data looks something like this. What i want to do now is replace the "Old ID" values by using matching values from the second table: First table is this,
Old ID | Usage
211 25
211 17
211 18
202 11
202 12
194 17
202 16
194 22
194 84
198 26
The second table with the matching values
Old ID | ID
211 abf
202 rdg
194 ufe
198
The first table should be changed after replacing each value in the Old ID with the corresponding values in the second table. If the value in the ID column is missing or "NULL" then the replaced value in the first table should show as "N/A" The first table should now look like this,
Old ID | Usage
abf 25
abf 17
abf 18
rdg 11
rdg 12
ufe 17
rdg 16
ufe 22
ufe 84
n/a 26
I have around 2 million such entries. Thanks a lot for you help
merge(df1, unique(df2), by="OldID", all.x=TRUE)ordf1$OldID <- df2$ID[match(df1$OldID, df2$OldID)]