Skip to content

Validate Object

The validate_object() function in the reportifyr package checks whether a file’s stored hash in its corresponding metadata .json file matches its current hash.


validate_object()

R: Validates a file's hash against a stored hash in the...
validate_objectR Documentation

Description

Validates a file's hash against a stored hash in the associated _metadata.json file

Usage

validate_object(file)

Arguments

file

The connection or name of the file where the R object is saved.

Value

A boolean declaring if the hashes are equal or not

Examples

## Not run: 
tables_path <- here::here("OUTPUTS", "tables")
outfile_name <- "01-12345-pk-theoph.csv"

validate_object(file = file.path(tables_path, out_name))

## End(Not run)

Returns

  • Logical: TRUE if the file’s hash matches the stored hash, otherwise FALSE.

Logging

  • Debug: Logs the start and end of the function.
  • Info: Logs a confirmation of file, its corresponding metadata file, and both hash values.
  • Warn: Logs when a hash mismatch is encountered.
  • Error: Logs errors for missing file, its corresponding metadata file, and if the metadata lacks a value for the hash field.

Additional Resources

  • reportifyr GitHub: Refer to the reportifyr repository for more details.
  • digest Reference Manual: Refer to the digest reference manual for specific inquiries related to hash values generated using digest::digest().