title: calculate jaccard distance between rows in r
body: <p>I need to calculate jaccard distance between each row in a data frame.
  the return need to be a matrix/data frame that represent the distance.</p>
  
  <p>like this: </p>
  
  <pre><code>   1     2   3 ..
  1  0    0.2  1 
  2  0.2  0    0.4
  3  1    0.4  0
  .
  .
  </code></pre>
  
  <p>my data:</p>
  
  <blockquote>
    <p>dput(items[1:10,])</p>
  </blockquote>
  
  <pre><code>structure(list(Drama = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
  0L), Comedy = c(0L, 1L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L), Crime = c(0L, 
  1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L), SciFi = c(1L, 0L, 0L, 0L, 
  0L, 0L, 0L, 0L, 0L, 0L), Kids = c(1L, 0L, 0L, 0L, 0L, 0L, 0L, 
  1L, 0L, 0L), Classic = c(1L, 0L, 0L, 1L, 0L, 0L, 0L, 1L, 0L, 
  0L), Foreign = c(0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L), Thriller = c(0L, 
  0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L), Action = c(0L, 0L, 0L, 1L, 
  1L, 1L, 1L, 1L, 1L, 1L), Adventure = c(0L, 0L, 0L, 0L, 0L, 0L, 
  0L, 0L, 0L, 0L), Animation = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
  0L, 0L), Adult = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L), History = c(0L, 
  0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L), Documentry = c(0L, 0L, 0L, 
  0L, 0L, 0L, 0L, 0L, 0L, 0L), Nature = c(0L, 0L, 0L, 0L, 0L, 0L, 
  0L, 0L, 0L, 0L), Horror = c(0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 
  0L), Show = c(0L, 1L, 1L, 0L, 1L, 0L, 0L, 0L, 0L, 0L), Series = c(0L, 
  0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L), BlackWhite = c(0L, 0L, 0L, 
  0L, 0L, 0L, 0L, 0L, 0L, 0L)), .Names = c("Drama", "Comedy", "Crime", 
  "SciFi", "Kids", "Classic", "Foreign", "Thriller", "Action", 
  "Adventure", "Animation", "Adult", "History", "Documentry", "Nature", 
  "Horror", "Show", "Series", "BlackWhite"), row.names = c(NA, 
  10L), class = "data.frame")
  </code></pre>
  
  <p>my code:</p>
  
  <pre><code>Jaccard_dist &lt;- dist(items, items, method = "Jaccard")
  
  write.csv(Jaccard_dist,'Jaccard_dist.csv')
  </code></pre>
  
  <p>do you know of a way to do this without using two for-loops?</p>