ranking: Windowed rank functions.

Description Usage Arguments Details Examples

Description

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11

Arguments

x

a vector of values to rank. Missing values are left as is. If you want to treat them as the smallest or largest values, replace with Inf or -Inf before ranking.

n

number of groups to split up into.

Details

Examples

1
2
3
4
5
6
7
8
9
x <- c(5, 1, 3, 2, 2, NA)
row_number(x)
min_rank(x)
dense_rank(x)
percent_rank(x)
cume_dist(x)

ntile(x, 2)
ntile(runif(100), 10)

sctyner/dplyr050 documentation built on May 17, 2019, 2:22 p.m.