title: How to calculate pairwise distances of nominal variable?
body: <p>I have the following data frame where I need to calculate pairwise differences between all rows(names here).</p>
  
  <pre><code>names&lt;- c("t1","t2","t3","t4","t5","t6","t7","t8")
  v1 &lt;- c(2,3,4,2,2,4,7,12)
  v2 &lt;- c(15,12,2,2,3,1,7,12) 
  v3&lt;- c(2,3,2,16,14,11,2,7)
  v4&lt;- c(12,3,4,5,9,1,12,13)
  
  mydf&lt;- data.frame(names,v1,v2,v3,v4)
  </code></pre>
  
  <p>So the expected output needs to be something similar to what dist(mydf[-1]) gives but those numbers are nominal characters and the order of values also matter. 
  e.g: "t1 and "t2" are 4/4 different while "t1" &amp; "t3" difference is 3/4.</p>
  
  <p>Thanks</p>