ranking
From dplyr v0.3
by Hadley Wickham
Windowed rank functions.
Six variations on ranking functions, mimicing the ranking functions
described in SQL2003. They are currently implemented using the built in
rank
function, and are provided mainly as a convenience when
converting between R and SQL. All ranking functions map smallest inputs
to smallest outputs. Use desc
to reverse the direction..
Usage
row_number(x)ntile(x, n)
min_rank(x)
dense_rank(x)
percent_rank(x)
cume_dist(x)
Arguments
 x
 a vector of values to rank
 n
 number of groups to split up into.
Details

row_number
: equivalent torank(ties.method = "first")

min_rank
: equivalent torank(ties.method = "min")

dense_rank
: likemin_rank
, but with no gaps between ranks 
percent_rank
: a number between 0 and 1 computed by rescalingmin_rank
to [0, 1] 
cume_dist
: a cumulative distribution function. Proportion of all values less than or equal to the current rank. 
ntile
: a rough rank, which breaks the input vector inton
buckets.
Examples
x < c(5, 1, 3, 2, 2)
row_number(x)
min_rank(x)
dense_rank(x)
percent_rank(x)
cume_dist(x)
ntile(x, 2)
ntile(runif(100), 10)
Community examples
Looks like there are no examples yet.