title: Keeping multiple orders in data.table in R
body: <p>I have a <code>transaction</code> table with 50M rows, with a few sample fields as follow:</p>
  
  <pre><code>buyer_id  month day hour location seller_id
  </code></pre>
  
  <p>I need to repeatedly sort this table to find the most popular sellers, locations, month etc. per buyer and create a new <code>summary</code> table. </p>
  
  <p>I then need to merge the <code>summary</code> table to the <code>transaction</code> table to find out which sellers are most popular in top frequent locations etc.</p>
  
  <p>Each time, I'll have to re-sort the <code>transaction table</code> according to several sets of columns. So I might end up with sorting <code>setorder(transaction, user_id, month, location)</code> several times.</p>
  
  <p>I know data.table create order by reference (kinda keep it in a hidden column), without copying the table. </p>
  
  <p>Is there a way to store and refer to these "hidden columns" explicitly, so that I don't have to resort data with so many times in the same way?</p>