October 2014
M T W T F S S
« May    
 12345
6789101112
13141516171819
20212223242526
2728293031  

ave

I discovered a new, very useful, R function yesterday: ave.

This is what it does: “Subsets of ‘x[]‘ are averaged, where each subset consist of those observations with the same factor levels.”

But interestingly, you can use any function other than average. The output of that function is set against each observation.

I wanted to, for example, stick sub-group ranks to each observation. I can think of several situations where this would be of great value!

V.

Comments are closed.