title: McNemar test in R - sparse data
body: <p>I'm attempting to run a good sized dataset through R, using the McNemar test to determine whether I have a difference in the proportion of objects detected by one method over another on paired samples. I've noticed that the test works fine when I have a 2x2 table of </p>
  
  <pre><code>   test1
     y    n
  y  34   2
  n  12   16
  </code></pre>
  
  <p>but if I try and run something more like:</p>
  
  <pre><code>34   0
  12   0
  </code></pre>
  
  <p>it errors telling me that ''x' and 'y' must have the same number of levels (minimum 2)'. </p>
  
  <p>I should clarify, that I've tried converting wide data to a 2x2 matrix using the table function on my wide data set, where rather than appearing as above, it negates the final column, giving me. </p>
  
  <pre><code>test1
      y
  y  34
  n  12
  </code></pre>
  
  <p>I've also run mcnemar.test using the factor object option, which gives me the same error, so I'm assuming that it does something similar. I'm wondering whether there is either a way to force the table function to generate the 2nd column despite their being no observations which would fall under either of those categories, or whether there would be a way to make the test overlook this missing data?</p>