title: Extracting flexible general patterns
body: <p>I'm looking for a simple and efficient way to extract general patterns of how elements repeat in a given vector (to later compare various vectors).
  So this should allow for example to correct semantic problems, where some poeple would call an observation of a color &quot;purple&quot; while others would call it &quot;violet&quot; etc.
  However, I need something very general and flexible, simple subsitution of terms is not realistic (since I don't know in advance all names that may come up).</p>
  <p>Here a example of 3 vectors, the 1st and 2nd are the same, just the elements were called differently, however the 3rd is different</p>
  <pre><code>aa=letters[rep(c(3:1,4),each=2)]
  ab=letters[rep(c(5,8:6),each=2)]
  ac=letters[c(1:2,1:3,3:4,4)]
  </code></pre>
  <p>I tried</p>
  <pre><code>as.numeric(factor(aa,labels=unique(aa)))
  as.numeric(factor(ab,labels=unique(ab)))
  </code></pre>
  <p>but as you can see, the result does not allow inidcating the same pattern for aa and ab (of always 2 repeats, until mooving to another item</p>