8 Settings and conditions
8.1 Options and environment variables
| Setting | Kind | Effect |
|---|---|---|
croissant.cache_dir |
R option | Default cache_dir of read_record_set() and hf_download(); otherwise tools::R_user_dir("croissant", "cache") |
HF_TOKEN |
Environment variable | Hugging Face token when the token argument is NULL |
HF_ENDPOINT |
Environment variable | Hugging Face Hub endpoint; otherwise https://huggingface.co |
8.2 Cache layout
| Directory | Content |
|---|---|
<cache_dir>/downloads/<hash>/ |
Files downloaded from http(s) URLs, keyed by their sha256, their md5, or a hash of the URL |
<cache_dir>/extracted/<hash>/ |
Extracted zip and tar archives, keyed by a hash of the archive’s path, size, and modification time |
<cache_dir>/hf/datasets/<owner>/<name>/<commit>/ |
Files downloaded from Hugging Face datasets |
Deleting a cache directory removes the copies; the next read downloads or extracts the files again.
8.3 Conditions
Each error class below inherits from rtemis_input_error and rtemis_error, so a handler for either class catches all of them.
| Class | Raised when |
|---|---|
croissant_read_error |
read_croissant() finds problems that prevent reading; the issues element holds a CroissantIssues object |
croissant_version_error |
A document is Croissant 0.8 or conforms to a version other than 1.0 or 1.1 |
croissant_json_error |
The input is not valid JSON, or is JSON but not an object |
croissant_structure_error |
A document holds more than one top-level node after JSON-LD processing |
croissant_file_error |
A file cannot be found, located, or extracted, or has an unsupported contentUrl scheme |
croissant_download_error |
A download fails |
croissant_checksum_error |
A downloaded file does not match its checksum |
croissant_format_error |
A field extracts a column from a file whose encoding format is not a supported table format |
croissant_record_error |
A record set cannot be assembled, for example because of a missing column or an undeclared join |
croissant_jsonpath_error |
A JSONPath uses syntax that croissant does not evaluate |
rtemis_dependency_error |
A suggested package required for the operation is not installed |
rtemis_file_error |
The input file does not exist |
rtemis_type_error |
An argument has the wrong type, such as a column class that croissant_from_data() does not map |
rtemis_value_error |
An argument has an invalid value |
rtemis_unsupported_error |
A gated Hugging Face dataset is requested without a token |
tryCatch(
read_record_set(path, "records"),
croissant_checksum_error = function(e) {
message("A file does not match its checksum: ", conditionMessage(e))
}
)8.4 API reference
The API reference documents every exported function and class.