title: Dynamically creating named list in R
body: <p>I need to create named lists dynamically in R as follows.</p>
  
  <p>Suppose there is an array of names.</p>
  
  <pre><code>name_arr&lt;-c("a","b")
  </code></pre>
  
  <p>And that there is an array of values.</p>
  
  <pre><code>value_arr&lt;-c(1,2,3,4,5,6)
  </code></pre>
  
  <p>What I want to do is something like this:</p>
  
  <pre><code>list(name_arr[1]=value_arr[1:3])
  </code></pre>
  
  <p>But R throws an error when I try to do this. Any suggestions as to how to get around this problem?</p>