title: Measures of dissimilarity (distance) between character vectors in R
body: <p>I have a seemingly easy question which however is troubling me a bit.</p>
  
  <p>I have couples of vectors made up of nominal attributes. They can be of different length and sometimes some of the attributes in one might not be included in the other. See <code>a</code> and <code>b</code> as two potential examples.</p>
  
  <pre><code>               a
  1  mathematician
  2       engineer
  3  mathematician
  4  mathematician
  5  mathematician
  6       engineer
  7  mathematician
  8  mathematician
  9  mathematician
  10 mathematician
  11 mathematician
  12      engineer
  13 mathematician
  14 mathematician
  15      engineer
  
                 b
  1      physicist
  2        surgeon
  3      physicist
  4        surgeon
  5      physicist
  6      physicist
  7        surgeon
  8        surgeon
  9      physicist
  10     physicist
  11 mathematician
  </code></pre>
  
  <p>Do you have in mind a measure (an index) that could summarize the dissimilarity between them? The type of measure I am looking for is something like the <a href="http://en.wikipedia.org/wiki/Euclidean_distance" rel="nofollow">Euclidean distance</a>, but for qualitative vectors.</p>
  
  <p>One option I thought of is to actually compute the Euclidean distance among the categorical vectors earlier transformed into frequency vectors. In this way, they would become quantitative and would be of the same length. But my question is, do you find this a sound approach?</p>
  
  <p>More generally, is there a R package that tackles these type of distances? Can you suggest other distances suitable to the case of nominal variables?</p>
  
  <p>Many thanks!</p>