R/util.R

Defines functions is_dir is_file is_installed make_sure_data_is_loaded

# Utilities

make_sure_data_is_loaded <- function(x) {
  if (!exists(x)) {
    do.call(utils::data, list(x, package = "kokudosuuchi"))
  }
}

is_installed <- function(pkg) {
  system.file(package = pkg) != ""
}

is_file <- function(x) file.exists(x) && !dir.exists(x)
is_dir  <- function(x) dir.exists(x)

Try the kokudosuuchi package in your browser

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

kokudosuuchi documentation built on Feb. 23, 2021, 5:06 p.m.