Learn R Programming

reproducible (version 3.2.1)

.urlRemapFn: Resolve the reproducible.urlRemap option to a remap function

Description

Internal. The reproducible.urlRemap option may be set to any of:

  • NULL -- no remapping;

  • a function(url, filename) (e.g. built with makeUrlRemap());

  • a data.frame/data.table manifest with filename and url columns; or

  • a length-one character path or URL to a CSV with those columns. This returns a single function(url, filename) (or NULL). For the data.frame/character forms it builds the function once via makeUrlRemap() and caches it (keyed on the option value), so the lookup is not rebuilt -- and a CSV path/URL is not re-read -- on every download. An invalid option value is ignored with a warning (returns NULL), so it can never break a download.

Usage

.urlRemapFn(opt = getOption("reproducible.urlRemap"))

Value

A function(url, filename) or NULL.

Arguments

opt

The current value of the reproducible.urlRemap option.