I have a data frame named A which are company names and cities, like
A:
name city
IBM NY
AMZ NY
ALI SH
TAOBAO London
Also a data frame B
B:
ID NAME1 CITY1 NAME2 CITY2
1 LENVO AMZ
2 APPLE HUAWEI
3 AMZ ALI
4 XIAOMI VIVO
5 IBM GOOGLE
In data B, I have two columns of company names, accordingly, two city columns which are blank (there are 10k in my real dataset with 6 name-city pairs) , what I want is that get the city name in dataset B from dataset A based on the name match, which the result C should be as below in this example: C
ID NAME1 CITY1 NAME2 CITY2
1 LENVO AMZ NY
2 APPLE HUAWEI
3 AMZ NY ALI SH
4 XIAOMI TAOBAO London
5 IBM NY GOOGLE
how to make it? Thanks in advance for any suggestion!