title: Avoiding the infamous "eval(parse())" construct
body: <p>Ok, so I'm running some loops to process data stored in list objects.  Ever mindful of the infamous <code>fortune</code> admonishment not to use <code>eval(parse(mystring))</code>, I came up with this:</p>
  
  <pre><code>Rgames&gt; bar
  $foo
  $foo$fast
  [1] 1 2 3 4 5
  
  $foo$slow
  [1]  6  7  8  9 10
  
  
  $oof
  $oof[[1]]
  [1]  6  7  8  9 10
  
  $oof[[2]]
  [1] 1 2 3 4 5
  
  
  Rgames&gt; rab&lt;-'bar'
  Rgames&gt; do.call('$',list(as.name(rab),'oof'))
  [[1]]
  [1]  6  7  8  9 10
  
  [[2]]
  [1] 1 2 3 4 5
  </code></pre>
  
  <p>Typically I'd be selecting a list (of which <code>bar</code> is one such) and then one element of the list (e.g.  <code>oof</code>) which contains my data.  The code above does the same thing as <code>eval(parse(text=paste(rab,'$','oof',sep='')))</code> .<br>
  I'm doing all this specifically because I want to use the lists' names rather than <code>[[x]]</code> notation as a safety mechanism (because not all list objects have their contents in the same order).   </p>
  
  <p>Should I stick with the advice from DWin in <a href="https://stackoverflow.com/questions/11025031/r-evalparse-is-often-suboptimal">R: eval(parse(...)) is often suboptimal</a> ?</p>