Create Rank Variable with dplyr

library(dplyr)

df <- df %>% mutate(rank = dense_rank(desc(variable_to_be_ranked)))