title: Replace NA with " ", but only in character columns
body: <p>I have a large dataset with ~200 columns of various types. I need to replace <code>NA</code> values with <code>""</code>, but only in character columns.</p>
  
  <p>Using the dummy data table</p>
  
  <pre><code>DT &lt;- data.table(x = c(1, NA, 2),
                  y = c("a", "b", NA))
  
  &gt; DT
      x    y
  1:  1    a
  2: NA    b
  3:  2 &lt;NA&gt;
  
  &gt; str(DT)
  Classes ‘data.table’ and 'data.frame':  3 obs. of  2 variables:
   $ x: num  1 NA 2
   $ y: chr  "a" "b" NA
  </code></pre>
  
  <p>I have tried the following for-loop with a condition, but it doesn't work.</p>
  
  <pre><code>for (i in names(DT)) {
    if (class(DT$i) == "character") {
      DT[is.na(i), i := ""]
    }
  }
  </code></pre>
  
  <p>The loop runs with no errors, but doesn't change the <code>DT</code>.</p>
  
  <p>The expected output I am looking for is this:</p>
  
  <pre><code>    x y
  1:  1 a
  2: NA b
  3:  2  
  </code></pre>
  
  <p>The solution doesn't necessarily have to involve a loop, but I couldn't think of  one.</p>