title: Replacing all missing values in R data.table with a value
body: <p>If you have an R data.table that has missing values, how do you replace all of them with say, the value 0? E.g.</p>
  
  <pre><code>aa = data.table(V1=1:10,V2=c(1,2,2,3,3,3,4,4,4,4))
  bb = data.table(V1=3:6,X=letters[1:4])
  setkey(aa,V1)
  setkey(bb,V1)
  tt = bb[aa]
  
      V1  X V2
   1:  1 NA  1
   2:  2 NA  2
   3:  3  a  2
   4:  4  b  3
   5:  5  c  3
   6:  6  d  3
   7:  7 NA  4
   8:  8 NA  4
   9:  9 NA  4
  10: 10 NA  4
  </code></pre>
  
  <p>Any way to do this in one line? If it were just a matrix, you could just do:</p>
  
  <pre><code>tt[is.na(tt)] = 0
  </code></pre>