title: A quick question on sequential sort/order
body: <p>I am trying to sort a data matrix with several columns. Here, I want to sort sequentially as in Excel. Once I sort the matrix by the first column, I would like to keep the first column, and then sort by the second column, then keep the first and second columns and then sort the rest of the matrix by the third column, and so on.</p>
  
  <p>For example, if my matrix is <code>dd</code> and I want to sort from 20 to 34 sequentially:</p>
  
  <pre><code>L &lt;- 34
  for(init in 20:L){
      dd &lt;- dd[with(dd, order(dd[,init],decreasing=T)), ]
                  }
  </code></pre>
  
  <p>This does not work; can anyone advise me with a correct script for this case?</p>