R/000.import.R

Defines functions import_future.apply import_future import_from

import_from <- function(name, default = NULL, package) {
  ns <- getNamespace(package)
  if (exists(name, mode = "function", envir = ns, inherits = FALSE)) {
    get(name, mode = "function", envir = ns, inherits = FALSE)
  } else if (!is.null(default)) {
    default
  } else {
    stop(sprintf("No such '%s' function: %s()", package, name))
  }
}

import_future <- function(name, default = NULL) {
  import_from(name, default = default, package = "future")
}

import_future.apply <- function(name, default = NULL) {
  import_from(name, default = default, package = "future.apply")
}

Try the doFuture package in your browser

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

doFuture documentation built on May 29, 2024, 10:26 a.m.