topK: Top K elements of a vector.

Description Usage Arguments Details Author(s) Examples

View source: R/hoff_functions.R

Description

Identify top K elements of a vector.

Usage

1
topK(x, K = 1, ignoreties = TRUE)

Arguments

x

The vector.

K

The number of indices to return.

ignoreties

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.

Details

This function returns the indices corresponding to the top elements of a vector.

Author(s)

Peter Hoff.

Examples

1
2
x <- c(3, 6, 2, 4, 1)
tensr:::topK(x, 3)

dcgerard/tensr documentation built on Aug. 16, 2018, 9:56 a.m.