title: Fisher test more than 2 groups
body: <p>Major Edit:
  I decided to rewrite this question since my original was poorly put. I will leave the original question below to maintain a record. Basically, I need to do Fisher's Test on tables as big as 4 x 5 with around 200 observations. It turns out that this is often a major computational challenge as explained <a href="http://www.physics.csbsju.edu/stats/contingency.problem.html" rel="nofollow">here</a> (I think, I can't follow it completely). As I use both R and Stata I will frame the question for both with some made-up data.</p>
  
  <p>Stata:</p>
  
  <pre><code>    tabi 1 13 3 27 46 \ 25 0 2 5 3 \ 22 2 0 3 0 \ 19 34 3 8 1 , exact(10)
  </code></pre>
  
  <p>You can increase <code>exact()</code> to 1000 max (but it will take maybe a day before returning an error).</p>
  
  <p>R:</p>
  
  <pre><code>    Job &lt;- matrix(c(1,13,3,27,46, 25,0,2,5,3, 22,2,0,3,0, 19,34,3,8,1), 4, 5,
           dimnames = list(income = c("&lt; 15k", "15-25k", "25-40k", "&gt;40k"),
           satisfaction = c("VeryD", "LittleD", "ModerateS", "VeryS", "exstatic")))
      fisher.test(Job)
  </code></pre>
  
  <p>For me, at least, it errors out on both programs. So the question is how to do this calculation on either Stata or R?</p>
  
  <p>Original Question:
  I have Stata and R to play with.
  I have a dataset with various categorical variables, some of which have multiple categories.
  Therefore I'd like to do Fisher's exact test with more than 2 x 2 categories
  i.e. apply Fisher's to a 2 x 6 table or a 4 x 4 table.</p>
  
  <p>Can this be done with either R or Stata ?</p>
  
  <p>Edit: whilst this can be done in Stata - it will not work for my dataset as I have too many categories. Stata goes through endless iterations and even being left for a day or more does not produce a solution.</p>
  
  <p>My question is really -  can R do this, and can it do it quickly ?</p>