title: how to dynamically call a variable?
body: <p>I'm working with three experiments that I store in three lists: <code>exp1</code>, <code>exp2</code> and <code>exp3</code>. Each list has several items (<code>name</code>, <code>conditions</code>, <code>dataset_a</code>, <code>dataset_b</code>, etc.). Sometimes I want to perform an operation on all the experiments. Is there a way to store their names in a variable and call them dynamically? This doesn't work:</p>
  
  <pre><code>all_exp &lt;- list(exp1=exp1,exp2=exp2,exp3=exp3)
  </code></pre>
  
  <p>Because if I later add something to the experiments, <code>all_exp</code> has a hard copy of the experiments at the previous state, not a reference.</p>
  
  <p>This sort of works:</p>
  
  <pre><code>all_exp_names &lt;- c("exp1","exp2","exp3")
  all_exp &lt;- lapply(all_exp_names, function(exp_name) (eval(parse(text=exp_name))))
  </code></pre>
  
  <p>but there must be a simpler way, and besides, the returned list loses the experiment names.</p>