| ensure_files_available_from_manifest | R Documentation |
Like ensure_files_available, but the files are described in a single declarative manifest (one row per file) instead of three parallel vectors. A manifest can be a CSV file (e.g., shipped with the package in inst/extdata) or a data.frame, see read_manifest for the expected format.
ensure_files_available_from_manifest(
pkg_info,
manifest,
base_url = NULL,
files_are_binary = NULL,
on_errors = "warn",
download = TRUE,
num_connections = getOption("pkgfilecache.num_connections", 2),
num_retries = 2
)
pkg_info |
named list. Package identifier, see get_pkg_info() on how to get one. |
manifest |
string or data.frame. The manifest to use, see |
base_url |
string or NULL. Base URL to derive the download URL for files that have no explicit URL, see |
files_are_binary |
logical vector. For each file, whether it is binary. Only required on Windows, when files need to be downloaded. See |
on_errors |
string. What to do if getting the files failed. One of c("warn", "stop", "ignore"). See |
download |
logical. Whether to try downloading missing files. Defaults to TRUE. Existing files (with correct MD5 if available) will never be downloaded. Set to FALSE to only check which files are available without downloading anything. |
num_connections |
integer. The number of parallel connections to use when downloading files, see |
num_retries |
integer. How many times to retry downloading files that failed, in addition to the first attempt, see |
Named list, like for ensure_files_available: the entries "available" and "missing" contain the manifest paths (as '/'-separated strings) that are available in, or missing from, the local file cache. The entry "file_status" is a logical vector in manifest row order indicating for each file whether it is available.
pkg_info = get_pkg_info("mypackage")
# A manifest as a data.frame: two files, URLs derived from base_url.
manifest = data.frame(path = c("sub/file1.txt", "file2.txt"),
stringsAsFactors = FALSE)
# Only check availability, do not download anything (download = FALSE).
# The files are missing, so a warning is expected (see 'on_errors').
res = suppressWarnings(ensure_files_available_from_manifest(pkg_info, manifest,
base_url = "https://example.com/data/",
download = FALSE))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.