title: Split vector of strings and paste subset of resulting elements into a new vector
body: <p>Define</p>
  
  <pre><code>z&lt;- as.character(c("1_xx xx xxx_xxxx_12_sep.xls","2_xx xx xxx_xxxx_15_aug.xls"))
  </code></pre>
  
  <p>such that</p>
  
  <pre><code>&gt; z
  [1] "1_xx xx xxx_xxxx_12_sep.xls" "2_xx xx xxx_xxxx_15_aug.xls"
  </code></pre>
  
  <p>I want to create a vector <em>w</em> such that</p>
  
  <pre><code>&gt; w
  [1] "1_12_sep" "2_15_aug"
  </code></pre>
  
  <p>That is, split each element of <em>z</em> by <em>_</em> and then join elements 1,4,5, with the <em>.xls</em> removed from the latter.</p>
  
  <p>I can manage the split part, but not sure what function to provide, e.g something like"</p>
  
  <pre><code>w &lt;- as.character(lapply(strsplit(z,"_"), function(x) ???))
  </code></pre>