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)]
}
DominikRafacz/deepdep documentation built on Feb. 27, 2023, 3:39 p.m.