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

From: Denis Chabot <chabotd_at_globetrotter.net>
Date: Tue 07 Jun 2005 - 10:00:56 EST


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



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Tue Jun 07 10:04:34 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:32:25 EST