title: Rename list elements which has names starting with specified characters using purrr package
body: <p>I have a list with element names like <code>x.height, x.weight, y.height, y.length, z.weight, z.price</code> I would like to extract the elements which names start with <code>&quot;x.&quot;</code> and rename these element by removing their prefix <code>&quot;x.&quot;</code>. This can be done in two steps:</p>
  <pre><code>list.new &lt;- list.old %&gt;% keep(str_detect(names(.), &quot;^x.&quot;)) 
  names(list.new) &lt;- str_replace(names(list.new), &quot;x&quot;, &quot;&quot;)
  </code></pre>
  <p>My first question: how to combine these two steps in a pipeline?</p>
  <p>At the end, I would like to process the list for all of the different prefixes <code>&quot;y.&quot;, &quot;z.&quot;</code> to get a new list with the renamed sublists like:</p>
  <pre><code>List of 3
   $ x:List of 2
    ..$ height: num 100
    ..$ weight: num 200
   $ y:List of 2
    ..$ height: num 300
    ..$ length: num 400
   $ z:List of 2
    ..$ weight: num 500
    ..$ price: num 600
  </code></pre>
  <p>Is it possible to do this using a single pipeline?</p>