R/max_n.R

Defines functions max_n

Documented in max_n

#' Auxiliary Internal Functions
#'
#' @param x Numeric vector
#' @param n Number of elements to return
#'
#' @return The largest `n` elements of a vector
#' @export
#'
max_n <- function(x, n)
{
  return(order(x, decreasing = TRUE)[1:n])
}

Try the i3pack package in your browser

Any scripts or data that you put into this service are public.

i3pack documentation built on June 8, 2025, 11:43 a.m.