title: Indexing redundantly named vector in R
body: <p>In R, when having a redundantly named vector, why is it not possible to retrieve all elements in the named vector with the selection operator?</p>
  
  <pre><code>v &lt;- c(1,2,3,4,5)
  names(v) &lt;- c("a","b","c","c","a")
  v["c"] ## Returns only 3, not c(3,4)
  </code></pre>
  
  <p>It looks like R assumes that vector names are unique and only retrieves the first element in a vector whose name match the argument in the selection operator.</p>
  
  <p>Is this some kind of optimization? Would it not be beneficial if we were able to select multiple elements in a vector with the same name attribute?
  Is the point to guarantee that the number of elements returned when using the indexing operator is the same as the number of elements in the indexing vector?</p>