Skip to content
Prev 157326 / 398506 Next

Newbie: Ranking a data frame, grouped by 2 or more columns

On Fri, Sep 26, 2008 at 3:54 PM, Matthew Pettis
<matthew.pettis at gmail.com> wrote:
This is easy to do with the (very soon to be released) plyr package:

library(plyr)
ddply(df, .(x, y), transform, rank = rank(v))

You can learn more about it at http://had.co.nz/plyr

Hadley