title: How to find unique identifiers by fuzzy string variables
body: <p>(apologies for poor phrasing of the title, I lack the proper vocabulary)</p>
  
  <p>Consider the following data frame, where <code>id3</code> is what we want to create by considering only column <code>id1</code> and <code>id2</code></p>
  
  <pre><code>df = data.frame(id1 = c(1,1,2,2,3,3,4,4),
              id2 = c('CompanyA Inc','CompanyA Inc.','CompanyA Inc','CompanyA Inc','ComapnyB','ComapnyB','NewNameB','ComapnyB'),
              id3 = c(1,1,1,1,2,2,2,2))
  </code></pre>
  
  <p>I want to create an identifier (<code>id3</code>) for each "company". <code>id2</code> is an "unclean" identifier (in the sense that names slightly change, but string cleaning is not an option). </p>
  
  <pre><code>df
     id1           id2 id3
  1    1  CompanyA Inc   1
  2    1 CompanyA Inc.   1
  3    2  CompanyA Inc   1
  4    2  CompanyA Inc   1
  5    3      ComapnyB   2
  6    3      ComapnyB   2
  7    4      NewNameB   2
  8    4      ComapnyB   2
  </code></pre>
  
  <p>I imagine one would need an algorithm which for a given <code>id1</code> value, checks all <code>id2</code> values and returns the <code>id1</code>'s that correspond and then assigns an id to this, but I fail to see how to do that properly... </p>