R/check_stratification_columns_available.R

Defines functions check_stratification_columns_available

Documented in check_stratification_columns_available

#' Check whether stratification columns are available
#' 
#' @param data `data.frame` with observation or simulation data
#' @param stratify vector of stratification columns
#' @param type either `observation` or `simulation`
check_stratification_columns_available <- function(data, stratify, type = "observation") {
  diffs <- setdiff(stratify, names(data))
  if(length(diffs) >=1) {
    stop(paste0("The following specified stratification columns were NOT found in ",type, " data: \n", 
                  paste(diffs, collapse = ",")))
  }
  return(TRUE)
}

Try the vpc package in your browser

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

vpc documentation built on Jan. 16, 2021, 5:44 p.m.