Select indices of the top-n highest values
topn.RdUtility function returning indices of the top-n elements in a numeric vector. Ties are broken randomly.
Examples
x <- c(5, 1, 3, 9, 7)
topn(x, 3)
#> [1] 1 4 5
topn.RdUtility function returning indices of the top-n elements in a numeric vector. Ties are broken randomly.
x <- c(5, 1, 3, 9, 7)
topn(x, 3)
#> [1] 1 4 5