R language : How to sort a vector and print Top X value when the value is flat ?
If I have a vector like
v <- c(1,2,3,3,4,5)
I want to print the TOP1~TOP3 values.
So I use:
sort(v)[1:3]
[1] 1 2 3
In this case,TOP3 have 2 value
what I want to print is:
[1] 1 2 3 3
and their index