title: Flip order Columns / Rows in a table
body: <p>I'm using the epiR package as it does nice 2 by 2 contingency tables with odds ratios, and population attributable fractions.</p>
  
  <p>As is common my data is coded
  0 = No
  1 = Yes</p>
  
  <p>So when I do</p>
  
  <pre><code>tabele(var_1,var_2)
  </code></pre>
  
  <p>The output comes out as a table  aligned like</p>
  
  <p><a href="https://i.stack.imgur.com/zpHI7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zpHI7.png" alt="enter image description here"></a></p>
  
  <p>For its input though epiR wants the top left square to be Exposed+VE Outcome+VE - i.e the top left square should be Var 1==1 and Var 2==1</p>
  
  <p>Currently I do this by recoding the zeroes to 2 or alternatively by setting as a factor and using re-level. Both of these are slightly annoying for other analyses as in general I want Outcome+VE to come after Outcome-VE</p>
  
  <p>So I wondered if there is an easy way (?within table) to flip the orientation of table so that it essentially inverts the ordering of the rows/columns?</p>
  
  <p>Hope the above makes sense - happy to provide clarification if not.</p>
  
  <hr>
  
  <p><strong>Edit:</strong> Thanks for suggestions below; just for clarification I want to be able to do this when calling table from existing dataframe variable - i.e when what I am doing is table(data$var_1, data$var_2) - ideally without having to create a whole new object</p>