title: Rename objects in environment r
body: <p>I'd like to rename objects in environment r. For example,</p>
  
  <pre><code>y1 &lt;- vector('list', 3)
  
  x1 &lt;- matrix(0, 3, 3)
  x2 &lt;- matrix(1, 3, 3)
  x3 &lt;- matrix(2, 3, 3)
  
  y1[[1]] &lt;- x1
  y1[[2]] &lt;- x2
  y1[[3]] &lt;- x3
  
  y2 &lt;- vector('list', 3)
  
  y2[[1]] &lt;- x1
  y2[[2]] &lt;- x2
  y2[[3]] &lt;- x3
  
  y &lt;- new.env()
  y$y1 &lt;- y1
  y$y2 &lt;- y2
  
  names(y)
  
  names(y) &lt;- c('a', 'b')
  </code></pre>
  
  <p>I expected that the name of lists inside <code>y</code> was <code>a</code> and <code>b</code>, that is, <code>names(y)</code> equals <code>c('a', 'b')</code>,</p>
  
  <p>Obs.: I can't rename manually the variables <code>y1</code> and <code>y2</code>, I need to change them inside the environment.</p>