R/utils.R

Defines functions is_top_n is_top_perc

is_top_perc <- function(x, perc) {
  is_top_n(x, ceiling(perc * length(x)))
}

is_top_n <- function(x, n) {
  seq_along(x) %in% order(x, decreasing = TRUE)[seq_len(n)]
}

Try the deepdep package in your browser

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

deepdep documentation built on June 22, 2024, 12:23 p.m.