title: Mean of all vector values with unique names
body: <p>I have a large list of non-unique named values, i.e.:</p>
  
  <pre><code>tscores
          11461         11461         11461         11461         14433
  -1.966196e+01  7.808853e-01  2.065178e+01  5.630565e+00 -7.295436e+00
          14433         14433         14433         14433         14433
   2.036339e+00 -6.704906e+00  1.603803e+00 -1.118324e+01  1.450554e+00
          14102         16153         16189         18563         18563
  -1.137429e+01  7.053336e-02  1.011208e+00 -7.811194e+00 -6.749376e-01
          18563         18563         22042         22042         22042
   7.480217e-01 -9.909211e-01 -9.577424e-01 -7.887699e-02 -4.867706e-01
  </code></pre>
  
  <p>I'd like to be able to pull out a subvector of all values that correspond to a name more efficiently.  At the moment, I'm using:</p>
  
  <pre><code>u_tscores &lt;- sapply(unique(names(tscores)), function(name, scores) {mean(scores[names(scores)==name])}, scores=tscores)
  </code></pre>
  
  <p>Which is far too slow for what I need.  I know there has to be an easier way to get all values with the same name.</p>