[R] how to create a variable to rank within subgroups

Denis Chabot chabotd at globetrotter.net
Tue Jun 7 02:00:56 CEST 2005


Hi,

I would like to create a new variable that would be the rank of a  
continuous variable within each level of a grouping variable. Say the  
first level of the grouping variable has 5 observations, I'd like  
them ranked from one to five and a new variable would hold the rank  
value (one to five). So forth for each level of the grouping variable.

I'm quite new with R and cannot figure out this one by myself.

Thanks in advance,

Denis Chabot




More information about the R-help mailing list