title: How to remove specific words in a column
body: <p>I have a Column consisting of several Country Offices associated a with a company, where I would like to shorten fx: China Country Office and Bangladesh Country Office, to just China or Bangladesh- In other words removing the words "Office" and "Country" from the column called Imp_Office.</p>
  
  <p>I tried using the tm-package, with reference to an earlier post, but nothing happened. </p>
  
  <p><strong>what I wrote:</strong> </p>
  
  <pre><code>library(tm)
  stopwords = c("Office", "Country","Regional")
  MY_df$Imp_Office &lt;- gsub(paste0(stopwords, collapse = "|","", 
  MY_df$Imp_Office))
  </code></pre>
  
  <p><strong>Where I got the following error message:</strong> </p>
  
  <pre><code>  Error in gsub(paste0(stopwords, collapse = "|", "", MY_df$Imp_Office)) 
      : 
        argument "x" is missing, with no default
  </code></pre>
  
  <p>I also tried using the function readLines:  </p>
  
  <pre><code>stopwords = readLines("Office", "Country","Regional")
  MY_df$Imp_Office &lt;- gsub(paste0(stopwords, collapse = "|","", 
  MY_df$Imp_Office))
  </code></pre>
  
  <p>But this didn't help either </p>
  
  <p>I have considered the possibility of using some other string manipulation method, but I don't need to detect, replace or remove whitespace - so I am kind of lost here. </p>
  
  <p>Thank you. </p>