Check for the Existence of Results Under a Set of Parameters
Source:R/check_hash_existence.R
check_hash_existence.Rd
This function checks for the existence of results saved under specified parameter list
in RDS files (saved with indexr
) within a given folder.
Usage
check_hash_existence(
folder,
parameters_list,
halt = FALSE,
hash_includes_timestamp = FALSE,
ignore_na = TRUE,
alphabetical_order = TRUE,
algo = "xxhash64",
ignore_script_name = FALSE
)
Arguments
- folder
A string specifying the directory containing the RDS files.
- parameters_list
A list of parameters for which a corresponding hash named file is checked.
- halt
Logical; if TRUE, the function stops execution if an existing file is found. This may be useful as a check before running a simulation.
- hash_includes_timestamp
Logical; if TRUE, timestamps are included in the hash generation process.
- ignore_na
Logical; if TRUE, NA values are ignored during hash generation.
- alphabetical_order
Logical; if TRUE, parameters are sorted alphabetically before hash generation.
- algo
Character string specifying the hashing algorithm to use. Default is
"xxhash64"
. See?digest
- ignore_script_name
Logical. If
TRUE
, the script name is ignored during hash generation.
Value
A logical of whether or not a file exists, unless halt = TRUE
and a file is found, then an error is thrown.
Examples
## Setup
tmp_dir <- file.path(tempdir(), "example")
dir.create(tmp_dir)
## Save an object
parameters_list <- list(example = "check_hash_existence")
save_objects(folder = tmp_dir, results = 1, parameters_list = parameters_list)
## Check that an object under specified parameters is saved
check_hash_existence(folder = tmp_dir, parameters_list)
#> [1] FALSE
## Cleanup
unlink(tmp_dir, recursive = TRUE)