title: How to order a data.table in R based on multiple columns with ties?
body: <p>I'm fairly new to data.table and have a basic question. I'm trying to reorder the following data table based the two columns.</p>
  
  <pre><code>library(data.table)
  DT &lt;- data.table(letter=c('a','a','a','a','b','b','c','d','d','d','d'),  
                   value =c(1,2,4,8,2,5,1,1,2,3,9))
  
          letter value
   1:      a     1
   2:      a     2
   3:      a     4
   4:      a     8
   5:      b     2
   6:      b     5
   7:      c     1
   8:      d     1
   9:      d     2
  10:      d     3
  11:      d     9
  </code></pre>
  
  <p>I want to sort the letters based on the lowest associated value, should they be equal the next value (if available) should be compared and so on. </p>
  
  <p>This should produce the following result:</p>
  
  <pre><code>    letter value
   1:      c     1
   2:      d     1
   3:      d     2
   4:      d     3
   5:      d     9
   6:      a     1
   7:      a     2
   8:      a     4
   9:      a     8
  10:      b     2
  11:      b     5
  </code></pre>
  
  <p>I have tried <code>DT[order(value), .SD, letter]</code> which does sort on value, but does not take subsequent values into account in case of ties at the lowest associated value. I feel there should be an easy way to do this but I can't find the answer. Thanks.</p>