I have a data.table A where one column is a descriptor code. I have another data.table B containing the descriptions that match those codes. How do I add a column to table A which matches the code's description in table B?
for example, table A currently looks like this:
Var1 Var2 Var3 code
qwer tyui op 1a
asdf ghjk ls 1a
lore mips um b4
foo bar dys 5c
bars foot ls b4
and table B looks like this:
code descriptor
1a the a1 description
b4 the b4 description
5c the 5c description
I would like table A to look like this:
Var1 Var2 Var3 code descriptor
qwer tyui op 1a the a1 description
asdf ghjk ls 1a the a1 description
lore mips um b4 the b4 description
foo bar dys 5c the 5c description
bars foot ls b4 the b4 description