R/utils.R

Defines functions show_condition .onLoad

Documented in show_condition

# Some utility functions

.onLoad <- function(libname, pkgname) {
  utils::data("industry_labels", package=pkgname, envir=parent.env(environment()))
  utils::data("owner_codes", package=pkgname, envir=parent.env(environment()))
  utils::data("qwi_var_names", package=pkgname, envir=parent.env(environment()))
  utils::data("state_info", package=pkgname, envir=parent.env(environment()))
}

# Helper for trycatching in the code
#'@title show_condition
#'@param code the code whose message you wish to interpret
#'@export
show_condition <- function(code) {
  tryCatch(code,
           error = function(c) "error",
           warning = function(c) "warning",
           message = function(c) "message"
  )
}

Try the tidyqwi package in your browser

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

tidyqwi documentation built on May 4, 2020, 5:10 p.m.