| is_rocrate_bag | R Documentation |
Check if path points to a valid RO-Crate bag
is_rocrate_bag(path, algo = NULL, bagit_version = "1.0")
path |
String with full path to a compressed file contain an RO-Crate bag, see bag_rocrate for details. Alternatively, a path to a directory containing an RO-Crate bag. |
algo |
String with algorithm used to generate the RO-Crate bag
(default: |
bagit_version |
String with version of BagIt used to generate the
RO-Crate bag (default: |
Returns a boolean flag to indicate if the given RO-Crate bag is valid.
Other RO-Crate BagIt archive functions:
bag_rocrate(),
load_rocrate_bag(),
unbag_rocrate()
# -------- SETUP --------
basic_crate <- rocrateR::rocrate()
# temp file
tmp_dir <- file.path(tempdir(), digest::digest(basename(tempfile())))
tmp <- file.path(tmp_dir, "ro-crate-metadata.json")
dir.create(tmp_dir)
# bag RO-Crate
path_to_roc_bag <- rocrateR::bag_rocrate(basic_crate, path = tmp_dir)
# -------- INPUT: RO-Crate BagIt archive --------
rocrateR::is_rocrate_bag(path_to_roc_bag)
# -------- INPUT: Path --------
rocrateR::unbag_rocrate(path_to_roc_bag) |>
rocrateR::is_rocrate_bag()
# delete temp directory
unlink(tmp_dir, recursive = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.