The difference between dist functions in r
<p>I want to calculate the dissimilarity indices on a binary matrix and have found several functions in R, but I can't get them to agree. I use the jaccard coefficient as an example in the four functions: <code>vegdist()</code>, <code>sim()</code>, <code>designdist()</code>, and <code>dist()</code>. I'm going to use the result for a cluster analysis.</p>

<pre><code>library(vegan)
library(simba)

#Create random binary matrix
function1 &lt;- function(m, n) {
  matrix(sample(0:1, m * n, replace = TRUE), m, n)
}
test &lt;- function1(30, 20)

#Calculate dissimilarity indices with jaccard coefficient
dist1 &lt;- vegdist(test, method = "jaccard")
dist2 &lt;- sim(test, method = "jaccard")
dist3 &lt;- designdist(test, method = "a/(a+b+c)", abcd = TRUE)
dist4 &lt;- dist(test, method = "binary")
</code></pre>

<p>Does anyone know why <code>dist1</code> and <code>dist4</code> are different from <code>dist2</code> and <code>dist3</code>?</p>