R/process.R

Defines functions process_plans

process_plans <- function(plans) {
  if (inherits(plans, 'redist_plans')) {
    plans <- attr(plans, 'plans')
  }
  if (!is.numeric(plans)) {
    cli::cli_abort('{.arg plans} should be a numeric vector or matrix.')
  }
  if (!is.matrix(plans)) {
    plans <- as.matrix(plans)
  }
  if (any(is.na(plans))) {
    cli::cli_abort('{.val NA} in argument to {.arg plans}.')
  }
  plans
}

Try the redistmetrics package in your browser

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

redistmetrics documentation built on April 11, 2022, 5:08 p.m.