Ranking functions:
row_number()
: Gives other row number if empty.
Equivalent to frank(ties.method = "first")
if provided a vector.
min_rank()
: Equivalent to frank(ties.method = "min")
dense_rank()
: Equivalent to frank(ties.method = "dense")
percent_rank()
: Ranks by percentage from 0 to 1
cume_dist()
: Cumulative distribution
row_number(x)
min_rank(x)
dense_rank(x)
percent_rank(x)
cume_dist(x)
A vector to rank
df <- data.table(x = rep(1, 3), y = c("a", "a", "b"))
df %>%
mutate(row = row_number())
#> # A tidytable: 3 × 3
#> x y row
#> <dbl> <chr> <int>
#> 1 1 a 1
#> 2 1 a 2
#> 3 1 b 3