| load_rocrate | R Documentation |
High-level loader that can read:
A ro-crate-metadata.json file
A directory containing an RO-Crate
A BagIt-wrapped RO-Crate directory
A zipped BagIt RO-Crate archive
load_rocrate(x, ...)
## S3 method for class 'rocrate'
load_rocrate(x, ..., verbose = FALSE)
## S3 method for class 'character'
load_rocrate(
x,
...,
verbose = FALSE,
bagit_version = "1.0",
load_content = FALSE,
max_file_size = 10 * 1024^2
)
x |
A path (character) or an existing rocrate object. |
... |
Reserved for future extensions. |
verbose |
Logical. If |
bagit_version |
String with version of BagIt used to generate the
RO-Crate bag (default: |
load_content |
Logical. If |
max_file_size |
Maximum file size (bytes) allowed when loading content. Default 10MB. |
An RO-Crate object.
# -------- 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)
# -------- INPUT: RO-Crate --------
rocrateR::load_rocrate(basic_crate, verbose = TRUE)
# -------- INPUT: Path --------
# save RO-Crate
rocrateR::write_rocrate(basic_crate, path = tmp)
# load RO-Crate
## with file name
rocrateR::load_rocrate(tmp, verbose = TRUE)
## with directory
rocrateR::load_rocrate(tmp_dir, verbose = TRUE)
# 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.