title: Replace entire string anywhere in dataframe based on partial match with dplyr
body: <p>I'm struggling to find the right dplyr code to use <code>grepl</code> or an equivalent to replace values throughout an entire data frame. </p>
  
  <p>i.e.: any  cell that contains 'mazda'  in it, should have it's entire content replaced with the new string 'A car'</p>
  
  <p>after lots of searching online, the closest I came was: </p>
  
  <p>The emphasis being on applying it to ALL columns. </p>
  
  <pre><code>library(dplyr)
  mtcars$carnames &lt;- rownames(mtcars)  # dummy data to test on
  </code></pre>
  
  <p>This line does the trick for entire sting being an exact match: </p>
  
  <pre><code>mtcars %&gt;% replace(., (.)=='Mazda RX4', "A car")
  </code></pre>
  
  <p>but my grepl attempt replaces the entire column with "A car" for some reason. </p>
  
  <pre><code>mtcars %&gt;% replace(., grepl('Mazda', (.)), "A car")
  </code></pre>