R/helpers.R

Defines functions make_id

#' Make IDs from a vector
#'
#' Simpler `redist::redist.county.id()` that handles NAs more gracefully
#'
#' @param x vector to match
#'
#' @return vector of matches
#' @noRd
#'
#' @examples
#' x <- sample(letters[1:3], 10, replace = TRUE)
#' x[10] <- NA
#' make_id(x)
make_id <- function(x) {
  vctrs::vec_group_id(x)
}

Try the redistmetrics package in your browser

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

redistmetrics documentation built on May 29, 2024, 8:02 a.m.