R/assertions.R

Defines functions assert_in

assert_in <- function(x, categorias){

  x %in% categorias

}


assertthat::on_failure(assert_in) <- function(call, env) {

  paste0(
    deparse(call$x),
    " deveria ser um desses valores: ",
    eval(call$categorias) %>% str_flatten(collapse = ", ")
  )
}

Try the epe4md package in your browser

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

epe4md documentation built on July 9, 2023, 7:28 p.m.