Identify top K elements of a vector.
topK(x, K = 1, ignoreties = TRUE)
The vector.
The number of indices to return.
If FALSE
, will return a vector of the
indices whose elements are greater than or equal to the Kth
largest element, resulting in a vector possibly of length
greater than K
in the case of ties.
This function returns the indices corresponding to the top elements of a vector.
# NOT RUN {
x <- c(3, 6, 2, 4, 1)
tensr:::topK(x, 3)
# }
Run the code above in your browser using DataLab