title: Calculating Hamming distance for two vectors in R?
body: <p>I'm trying just to calculate the Hamming distance between two vectors in R. I'm currently attempting to use the "e1071" package, and the hamming.distance function, as follows: </p>
  
  <pre><code>library(e1071)
  H &lt;- hamming.distance(X) 
  </code></pre>
  
  <p>Where X is a data.frame with 2 rows and (in my particular data) 667 columns, and every observation is 0 or 1. </p>
  
  <p>Initially I got the error: </p>
  
  <pre><code>Error: evaluation nested too deeply: infinite recursion / options(expressions=)?
  </code></pre>
  
  <p>After some research, it appeared that one fix might be increasing the basic option in R. This I did via options(expressions=5000), and then tried varying values in place of the 5000. But this only produced the error: </p>
  
  <pre><code>Error: C stack usage is too close to the limit
  </code></pre>
  
  <p>I'm not much of a programmer, and the fixes for this most recent error appear to have to do with something inside the package e1071 possibly not being called correctly (or at the right time). </p>
  
  <p>Any ideas on what I'm doing wrong? I eventually want the Hamming distances between a large number of vectors, and this was just a starting point. If this has to do with memory allocation, any suggestions for how to deal with it? </p>