generate_hash {indexr} | R Documentation |
Generate a Consistent Hash for an Argument List
Description
This function generates a hash value for a given list of arguments. It is designed to produce a consistent hash by optionally removing NA values, ordering arguments alphabetically, handling timestamp inclusion, etc.
Usage
generate_hash(
parameters_list,
hash_includes_timestamp = FALSE,
ignore_na = TRUE,
alphabetical_order = TRUE,
algo = "xxhash64",
ignore_script_name = FALSE
)
Arguments
parameters_list |
A named list of arguments for which the hash will be generated. Each element in the list should correspond to a parameter. |
hash_includes_timestamp |
Logical; if FALSE, any timestamp included in parameters_list will be removed before hash generation. If TRUE, the timestamp will be included in the hash calculation. |
ignore_na |
Logical; if TRUE, any NA values in parameters_list will be removed before hash generation. |
alphabetical_order |
Logical; if TRUE, the arguments in parameters_list will be sorted alphabetically by their names before hash generation. |
algo |
The hash algorithm to use (See |
ignore_script_name |
Logical. If |
Value
A character string representing the hash value of the provided argument list.
Examples
args <- list(param1 = "value1", param2 = 100, param3 = NA)
generate_hash(args)