title: Vector subsetting performance: name versus index
body: <p>If I have a vector <code>v</code> with names:</p>
  
  <pre><code>John       Murray     Lisa       Mike       Joe       Ann 
  0.0832090  0.0475580 -0.2797860  0.1086225  0.0104590 -0.0028250 
  </code></pre>
  
  <p>What is time complexity of <code>v['Joe']</code> versus <code>v[4]</code>? I guess the former would take O(log n) as it should involves binary search, but I'm still not sure whether the latter is O(1) or not.</p>
  
  <p>Also, does the result generalize to the case when <code>v</code> is a list/data frame rather than an atomic vector?</p>