R/helpers.R

Defines functions max_k min_k

min_k <- function(v, k) {
  sort(v)[seq_len(k)]
}

max_k <- function(v, k) {
  sort(v, decreasing = TRUE)[seq_len(k)]
}

Try the geomander package in your browser

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

geomander documentation built on April 16, 2023, 5:18 p.m.