title: why does knitr caching fail for data.table `:=`?
body: <p>This is related in spirit to <a href="https://stackoverflow.com/q/15267018/1900520">this</a> question, but must be different in mechanism.</p>
  
  <p>If you try to cache a <code>knitr</code> chunk that contains a <code>data.table</code> <code>:=</code> assignement then it acts as though that chunk has not been run, and later chunks do not see the affect of the <code>:=</code>.</p>
  
  <p>Any idea why this is? How does <code>knitr</code> detect objects have updated, and what is <code>data.table</code> doing that confuses it?</p>
  
  <p>It appears you can work around this by doing <code>DT = DT[, LHS:=RHS]</code>.</p>
  
  <p><strong>Example</strong>:</p>
  
  <pre><code>```{r}
  library(data.table)
  ```
  Data.Table Markdown
  ========================================================
  Suppose we make a `data.table` in **R Markdown**
  ```{r, cache=TRUE}
  DT = data.table(a = rnorm(10))
  ```
  Then add a column using `:=`
  ```{r, cache=TRUE}
  DT[, c:=5] 
  ```
  Then we display that in a non-cached block
  ```{r, cache=FALSE}
  DT
  ```
  The first time you run this, the above will show a `c` column, 
  from the second time onwards it will not.
  </code></pre>
  
  <p><strong>Output on second run</strong></p>
  
  <p><img src="https://i.stack.imgur.com/1VTSN.gif" alt="knitr output"></p>