'Dummy code based on whether two other variable match each other

for my master thesis i am working with Rstudio and analyze M&A data. I want to create a dummy code (Firm relatedness yes/no) based on whether the acquiring & target firms SIC Code match.

I do know how to create dummy codes but not based on the matching of other two variables. can anyone help? enter image description here

below you find a link to the screenshot. so what i basically want to do or even know (if its possible) is to generate dummy values for the column Firm relatedness based on the match of NAICS Codes e.g.: 221111 (acquirer naics code) & 221111 (target firm) Firm relatedness 1, otherwise 0 i could do it manually in excel, but on a larger scale it would take some more time



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source