title: How do I run apply on a data.table?
body: <p>I have a <code>data.table</code> with columns 2 through 20 as strings with spaces (e.g., "Species Name"). I want to run <code>str_replace()</code> on all those columns simultaneously so all the "Species Name" become "Species_Name".  I can either do:</p>
  
  <pre><code>data.table(apply(as.data.frame(dt[,2:dim(dt)[2], with=F]), 2, 
                                 function(x){ str_replace(x," ","_") }))
  </code></pre>
  
  <p>or if I keep it as a <code>data.table</code> object, then I can do this one column at a time:</p>
  
  <pre><code>dt[,SpeciesName := str_replace(SpeciesName, " ", "_")
  </code></pre>
  
  <p>How do I do this for all columns 2 through the end similar to the one of the above?</p>