title: How can I use gsub in multiple specific column in r
body: <p>Could you help me please for answer the little Q?</p>
  
  <p>I have data.frame like under. than, </p>
  
  <p>I want to use gsub function specific column in data.frame easily</p>
  
  <p>Because the change character is SAME! but I want change lots of specific column.</p>
  
  <p>In example code, It have just 4 column but my data have over 10 column, and I want change 6~7 specific column (not continuous).</p>
  
  <p>And changing same text...</p>
  
  <p>Please help Thanks</p>
  
  <p>I'm doing like these</p>
  
  <pre><code>data$col1&lt;-gsub("sfsdf", "Hi", data$col1)
  data$col3&lt;-gsub("sfsdf", "Hi", data$col3)
  data$col4&lt;-gsub("sfsdf", "Hi", data$col4)
  </code></pre>
  
  <p>and so on...</p>
  
  <p>It`s too many column...</p>
  
  <pre><code>col1 &lt;- 1:10   
  col2 &lt;- 21:30   
  col3 &lt;- c("503.90", "303.90 obs", "803.90sfsdf sf", "203.90 obs", "303.90", "103.90 obs", "303.90", "403.90 obs", "803.90sfsdf sf", "303.90 obs")   
  col4 &lt;- c("303.90", "303.90 obs", "303.90", "203.90 obs", "303.90", "107.40fghfg", "303.90", "303.90 obs", "303.90", "303.90 obs")
  
  data &lt;- data.frame(col1, col2, col3, col4)
  
  data$col3 &lt;- as.factor(data$col3)
  data$col4 &lt;- as.factor(data$col4)
  </code></pre>
  
  <p><a href="https://stackoverflow.com/questions/49431216/using-gsub-on-columns-in-r">Using gsub on columns in R</a></p>