title: Select elements from a character vector with strsplit
body: <p>I have a character vector which looks like this:</p>
  
  <pre><code>chars &lt;- c("Classics football boots", "Classics football shoes","football shoes", "new footbal shoes")
  </code></pre>
  
  <p>In this <code>chars</code> object i want to select only elements <code>football shoes &amp; football boots</code>. With maintaining the order because i need to replace the vector back into a <code>dataframe</code>.</p>
  
  <p>If tried many things but i think this comes most close:</p>
  
  <pre><code>for (i in grep("Classics",chars)){
    temp &lt;- as.character(strsplit(chars[i], " ")[[1]][c(2,3)])
    temp2 &lt;- as.character(na.omit(temp))
    chars[i] &lt;- temp2
  }
  </code></pre>
  
  <p>How can i get the object like this:</p>
  
  <p><code>c("football boots", "football shoes","football shoes", "new footbal shoes")</code></p>
  
  <p>So i only want to touch the values containing classics (or whatever word of interest).</p>
  
  <p>Update:</p>
  
  <p>Since I see that the question is not clear I will try to elaborate a bit more:</p>
  
  <p>The vector that I have contains 4000 plus values. So I want to select values from the vector based on some string (in this example "Classics"). Then if I find that word I want to be able to select only parts of that string that are needed. In this example I want to select the second and third element of that value. Hope its more clear now.</p>