mutate(row_number(key)) isn't equivalent to mutate(rank(key, ties.method = "first")) and mutate(dplyr::row_number(key)). I feel it's a bug.
library(dplyr)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
data_frame(a = c("a", "b", "C")) %>% arrange(a)
#> # A tibble: 3 × 1
#> a
#> <chr>
#> 1 a
#> 2 b
#> 3 C
data_frame(a = c("a", "b", "C")) %>% mutate(rank(a, ties.method = "first"))
#> # A tibble: 3 × 2
#> a `rank(a, ties.method = "first")`
#> <chr> <int>
#> 1 a 1
#> 2 b 2
#> 3 C 3
data_frame(a = c("a", "b", "C")) %>% mutate(row_number(a))
#> # A tibble: 3 × 2
#> a `row_number(a)`
#> <chr> <int>
#> 1 a 2
#> 2 b 3
#> 3 C 1
data_frame(a = c("a", "b", "C")) %>% mutate(dplyr::row_number(a))
#> # A tibble: 3 × 2
#> a `dplyr::row_number(a)`
#> <chr> <int>
#> 1 a 1
#> 2 b 2
#> 3 C 3
mutate(row_number(key))isn't equivalent tomutate(rank(key, ties.method = "first"))andmutate(dplyr::row_number(key)). I feel it's a bug.