title: Does R `unique` always return values in same order?
body: <p>Stupid example:</p>
  
  <pre><code>df &lt;- data.frame(group=rep(LETTERS, each=2), value=1:52)
  res &lt;- unlist(lapply(unique(df$group), function(x) mean(subset(df, group==x)$value)))
  names(res) &lt;- unique(df$group)
  </code></pre>
  
  <p>Will <code>res</code> always be?</p>
  
  <pre><code>   A    B    C    D    E    F    G    H    I    J    K    L    M    N    O    P 
   1.5  3.5  5.5  7.5  9.5 11.5 13.5 15.5 17.5 19.5 21.5 23.5 25.5 27.5 29.5 31.5 
     Q    R    S    T    U    V    W    X    Y    Z 
  33.5 35.5 37.5 39.5 41.5 43.5 45.5 47.5 49.5 51.5 
  </code></pre>
  
  <p>Or will it ever happen that the means calculated on line 2 won't match up to the names on line 3? I guess it depends on the underlying implementation of <code>unique</code> in the R base, but I'm not sure where to find that.</p>