View source: R/miscellaneous_functions.R
fun_kLargest | R Documentation |
k
-largest/smallest values (and apply a function to these
values)Find the k
-largest/smallest values (and apply a function to these
values)
fun_kLargest(x, largest = TRUE, fun = NULL, k = 10L, na.rm = FALSE, ...)
x |
A numeric vector |
largest |
A logical value. See return value. |
fun |
A function which requires one argument or |
k |
An integer value. The |
na.rm |
A logical value indicating whether |
... |
Optional arguments to be passed to |
A vector of length k
,
if is.null(fun)
, then a vector with the k
-largest
(if largest = TRUE
) or k
-smallest
(if largest = FALSE
) values of x
;
if fun = "index"
, then a vector with indices of the
k
-largest/smallest values (NOTE: this is truncated to the
k
-first indices!).
Otherwise, the result of applying fun
to the k
-largest/smallest values.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.