title: Advanced ordering of data.frame using multiple columns
body: <pre><code>#data as follows;
  values &lt;- c(1,1,1,0,1,1)
  values2 &lt;- c(0,1,0,1,0,1)
  values3 &lt;- c(0,0,0,0,0,1)
  
  Data &lt;- data.frame(name = names, value = values, value2 = values2, value3 = values3)
  Data[order(Data[,4], Data[,3], Data[,2]),] # basic ordering of data in base R
  </code></pre>
  
  <p><strong>Question 1.</strong></p>
  
  <p>Is there a way to call something like <code>Data[order(Data[,4:2],),]</code> thus ordering all columns the same as the above code. (I have around 100 binary columns which I would like to use to order a <code>data.frame</code> consisting of 1600 rows and around 1620 columns so my code would look something like this <code>Data[order(Data[,21:1620],),])</code></p>
  
  <p><strong>Question 2.</strong></p>
  
  <p>What if I wanted to have 'co-occurrences' ordered in a different configuration, consider;</p>
  
  <pre><code>smallData[order(smallData[,4], smallData[,3], smallData[,2]),]
  </code></pre>
  
  <p>Results:</p>
  
  <pre><code>   name value value2 value3
  1  paul     1      0      0
  3  dave     1      0      0
  5  john     1      0      0
  4  will     0      1      0
  2  mark     1      1      0
  6 steph     1      1      1
  </code></pre>
  
  <p>Instead I would like</p>
  
  <pre><code>   name value value2 value3
  1  paul      1      0      0
  3  dave      1      0      0
  5  john      1      0      0
  2  mark      1      1      0
  6 steph      1      1      1
  4  will      0      1      0
  </code></pre>