The book R for Data Science goes over ranking creation functions, and I'm having trouble understanding the examples even after looking at the documentation.
Here is the example:
y <- c(1, 2, 2, NA, 3, 4)
min_rank(y)
#> [1] 1 2 2 NA 4 5
min_rank(desc(y))
#> [1] 5 3 3 NA 2 1
row_number(y)
#> [1] 1 2 3 NA 4 5
dense_rank(y)
#> [1] 1 2 2 NA 3 4
percent_rank(y)
#> [1] 0.00 0.25 0.25 NA 0.75 1.00
cume_dist(y)
#> [1] 0.2 0.6 0.6 NA 0.8 1.0
Questions: min_rank: - where is the 5 from? and why isn't NA last? min_rankd(desc()) -- why are there 2 3s and not 2 2's? row_number: still confused on NA positoning, and wouldn't there be 6 rows?