I have a dataframe that looks like:
ID Text_1 Text_2 Text_3
1 apple orange NA
2 NA banana NA
3 NA NA pear
4 citrus NA grape
5 NA carrot NA
This is basically a lookuptable in order to identify ID that I want to write it into dataframe b
Line Text_1 Text_2 Text_3
1 apple NA NA
2 apple orange NA
3 NA carrot NA
4 citrus NA grape
5 NA NA grape
6 NA NA pear
7 NA NA pear
8 NA carrot NA
I want to update dataframe b to produce:
Line Text_1 Text_2 Text_3 ID
1 apple NA NA
2 apple orange NA 1
3 NA carrot NA 5
4 citrus NA grape 4
5 NA NA grape
6 NA NA pear 3
7 NA NA pear 3
8 NA carrot NA 5
Could anyone help me with the code required to make this work. It has to be exact match when doing the loopup.
Help is highly appreciated