How do I create a spatial contiguity dummy for my regression in R?

Solution for How do I create a spatial contiguity dummy for my regression in R?
is Given Below:

Currently, I am trying to set up a dummy for regions that are contigious (1 if adjacent, 0 if not) in my regression. Sadly, I have just find answers for a spatial weight matrices, but that is not what I am looking for, because I am looking for a new variable (Contiguity) in my regression.

My data table would look like this (Gravity-Model):

Region_1; Region_2; Distance; Contiguity Dummy

I have information about the geometry of each region.

Thank you very much in advance for any kind of help!

Best regards,
Christian