Hi everyone,
I am replicating a study. In the original study, the authors compare firms located in adjacent communities. Those communities lie in different states (shared-border communities). The original dataset has community_id, and shared_border_community_id (created by ArcGIS and to show that those communities share border with each other). Now I have another dataset. I also have the same community_id in the original dataset, but I don’t know how to create the shared_border_community_id in my dataset.
I really hope that your expertise in coding will help me solve this problem.
I attach here the format of the original dataset. firms have the same 'com_pairID' will be used to compared with each other.
Very appreciate!

com_pairID communeID_2012 id_nganh id_firm
1 29863 2703372 2668551
1 29863 2731230 2696319
1 30667 228167 228002
1 30667 2727920 2693023
1 30667 2697033 2662233
2 30667 2654695 2620068
2 30667 2697033 2662233
2 30667 228167 228002
2 30667 272711 272512
2 30667 2820961 2785725
3 29890 2820805 2785569
3 29890 2772064 2737022
3 29890 2616859 2582414

My dataset:
communeID_2012 id_firm12 id_nganh12 nganh_kd12
26116 162962 162962 56101 56101
25096 229310 229310 96310 47711
355 452409 452409 56101 56309
26515 7839 7839 47721 47721
14176 12902 12902 47224 47224
7342 34805 34805 10611 10611
9253 45376 45376 47812 47223
19801 72596 72596 55909 68100

Because two datasets are too large, I just post here their sample.