title: R remove multiple text strings in data frame
body: <p>New to R. I am looking to remove certain words from a data frame. Since there are multiple words, I would like to define this list of words as a string, and use gsub to remove. Then convert back to a dataframe and maintain same structure. </p>
  
  <pre><code>wordstoremove &lt;- c("ai", "computing", "ulitzer", "ibm", "privacy", "cognitive")
  
  a
  id                text time      username          
   1     "ai and x"        10     "me"          
   2     "and computing"   5      "you"         
   3     "nothing"         15     "everyone"     
   4     "ibm privacy"     0      "know"        
  </code></pre>
  
  <p>I was thinking something like:</p>
  
  <pre><code>a2 &lt;- apply(a, 1, gsub(wordstoremove, "", a)
  </code></pre>
  
  <p>but clearly this doesnt work, before converting back to a data frame. </p>