title: Winsorize data by group with data.table
body: <p>I have a dataset as below:  </p>
  
  <pre><code>dt &lt;- fread("    ID  Year  POP     REV
  A   1970  13116   3829
    A   1971  13116   4020
    B   1972    110      0
    C   1972    870     17
    D   1972    500     20
    D   1972    300     10", header = T)
  
  ID  Year  POP     REV
  A   1970  13116   3829
  A   1971  13116   4020
  B   1972    110      0
  C   1972    870     17
  D   1972    500     20
  D   1972    300     10
  </code></pre>
  
  <p>I know there is a function <code>Winsorize()</code> to do such thing.<br>
  However, I don't know how to winsorize by <code>Year</code>.<br>
  The code I operate <code>winsorize()</code> as below:  </p>
  
  <pre><code>winsorize(dt$POP, minval = quantile(dt$POP, 0.01), maxval = quantile(dt$POP, 0.99), probs = c(0.01, 0.99))
  [1] 2108.296 2108.296  110.000  870.000  500.000  300.000
  </code></pre>
  
  <p>Any solution on how to do this with package <code>data.table</code>?</p>