fingerprint: Tool: fingerprint

View source: R/fingerprint.R

fingerprintR Documentation

Tool: fingerprint

Description

Function which creates a unique fingerprint for a madrat function based on the code of the function itself, other madrat functions which are called by this function and of all source folders involved in the process. The fingerprint can serve as an indication whether the workflow for the given function has been most likely changed, or not. If all involved source folders and the code of all involved functions remains the same, also the fingerprint will stay the same, otherwise it will change. Hence, it can be to figure out whether a cache file can be used for further calculations, or whether the calculation should be redone.

Usage

fingerprint(name, details = FALSE, graph = NULL, ...)

Arguments

name

Name of the function to be analyzed

details

Boolean indicating whether additional details in form of an attribute with underlying hash information should be added or not

graph

A madrat graph as returned by getMadratGraph. Will be created with getMadratGraph if not provided.

...

Additional arguments for getMadratGraph in case that no graph is provided (otherwise ignored)

Value

A fingerprint (hash) of all provided sources, or "fingerprintError"

Note

For a better performance only the first 300 bytes of each file and the corresponding file size is hashed. As the fingerprint function only takes madrat-based functions into account (e.g. read-functions or calc-functions), but does ignore all other functions there might be cases where calculations actually changed, but the fingerprint is still the same. In a similar fashion it is possible that the fingerprint changes even though the workflow stayed the same (as the dependencies are sometimes overestimated).

Author(s)

Jan Philipp Dietrich, Pascal Führlich

See Also

readSource

Examples

madrat:::fingerprint("toolGetMapping", package = "madrat")

madrat documentation built on Aug. 23, 2023, 5:10 p.m.