title: R change order of column values in a data.table according to a permutation
body: <p>I have a data.table with a class column and a number of value columns, e.g.</p>
  
  <pre><code>     class  v1  v2  v3
  1:       1  10   3   8
  2:       2   2  24   7
  3:       1  70   3   9
  </code></pre>
  
  <p>Now, <strong>for a subset</strong> of data.table (say class=1), I need to change the order of values in each 
  row according to a permutation that I have. For instance, if the permutation is</p>
  
  <pre><code>3   1   2
  </code></pre>
  
  <p>The result should look like</p>
  
  <pre><code>     class  v1  v2  v3
  1:       1   8  10   3
  2:       2   2  24   7
  3:       1   9  70   3
  </code></pre>
  
  <p>What's the best way to achieve this using data.table? </p>
  
  <p>I can alternatively convert my data to matrix, if that's more efficient. Thanks!</p>