How to get ranks with no gaps when there are ties among values?

后端 未结 8 1299
感情败类
感情败类 2020-12-03 14:26

When there are ties in the original data, is there a way to create a ranking without gaps in the ranks (consecutive, integer rank values)? Suppose:

x <-           


        
8条回答
  •  猫巷女王i
    2020-12-03 15:12

    try to think about another way

    x <-  c(10,10,10,5,5,20,20)
    as.numeric(as.factor(x))
    [1] 2 2 2 1 1 3 3
    

提交回复
热议问题