title: R fuction does not return data.table if the last line is to drop a column
body: <p>I joined two data.tables, dropped the join column and returned the joined datatable. When the function is called, it returns null. If I print the datatable before return, it returns. Tried other operations like str or setorder even then it did not. Why does this happen?</p>
  <pre><code>library(data.table)
  dmap &lt;- function(){
      xx = unlist(strsplit('abcpqr', ''))
      div = data.table(division=rep(c('abc', 'pqr'), each=3), state=xx)
      stc = data.table(state=xx, stcd = 1:6)
      div = div[stc, on='state']
      div[, state := NULL]
      # print(str(div))
      # setorder(div, stcd)
      # print(div)
      return(div)
  }
  
  dmap()
  </code></pre>
  <p>Tried on MacOS 11.5.2 (20G95)
  R version 4.0.3 (2020-10-10) -- &quot;Bunny-Wunnies Freak Out&quot;
  data.table 1.14.1</p>
  <p>Red Hat Enterprise Linux release 8.3 (Ootpa)
  R version 4.0.5 (2021-03-31) -- &quot;Shake and Throw&quot;
  data.table 1.14.0 using 8 threads</p>