title: How to rename elements inside a list of lists in the an efficient manner in R?
body: <p>I currently have a large list with around 5000 elements. A reproducible example is like:</p>
  
  <pre><code>List.5000 &lt;- replicate(5000, c(list(A='A',value.A=10),list(B='B',value.B=20)), simplify = F)
  </code></pre>
  
  <p>which has:</p>
  
  <pre><code>&gt; List.5000
  [[1]]
  [[1]]$A
  [1] "A"
  
  [[1]]$value.A
  [1] 10
  
  [[1]]$B
  [1] "B"
  
  [[1]]$value.B
  [1] 20
  
  
  [[2]]
  [[2]]$A
  [1] "A"
  
  [[2]]$value.A
  [1] 10
  
  [[2]]$B
  [1] "B"
  
  [[2]]$value.B
  [1] 20
  ....
  </code></pre>
  
  <p>When I call <code>names(List.5000)</code> it returns <code>NULL</code>. But when I call <code>names(List.5000[[1]])</code>, it gives:</p>
  
  <pre><code>"A"       "value.A" "B"       "value.B"
  </code></pre>
  
  <p>I would like to change the name <code>"B"</code> to <code>"Z"</code>. Is there a way to do this without resorting to creating a new list, then looping and reconstructing?</p>