title: Using grepl in R
body: <p>In which cases could these 2 different ways of implimentation would give different results?</p>
  
  <pre><code>data(mtcars)
  firstWay &lt;- mtcars[grepl('6',mtcars$cyl),]
  SecondWay &lt;- mtcars[mtcars$cyl=='6',]
  </code></pre>
  
  <p>If these ways always give the same results which of them is recommended and why? Thanks</p>