This is intended to be used within the
Cache function, but can be used to evaluate what
simList would look like once it is converted to a repeatably digestible object.
# S4 method for simList
.robustDigest(object, .objects, length, algo, quick, classOptions)
an object to digest.
Character vector of objects to be digested. This is only applicable
if there is a list, environment (or similar) with named objects
within it. Only this/these objects will be considered for caching,
i.e., only use a subset of
the list, environment or similar objects. In the case of nested list-type
objects, this will only be applied outermost first.
Numeric. If the element passed to Cache is a
object (from e.g.,
asPath(filename)) or it is a
file-backing, then this will be
digest::digest, essentially limiting the number of bytes
to digest (for speed). This will only be used if
quick = FALSE.
getOption("reproducible.length"), which is set to
The algorithms to be used; currently available choices are
md5, which is also the default,
little or no disk-based information will be assessed, i.e., mostly its
memory content. This is relevant for objects of class
Raster currently. For class
character, it is ambiguous
whether this represents a character string or a vector of file paths. The function
will assess if it is a path to a file or directory first. If not, it will treat
the object as a character string. If it is known that character strings should
not be treated as paths, then
quick = TRUE will be much faster, with no loss
of information. If it is file or directory, then it will digest the file content,
basename(object). For class
Path objects, the file's metadata
(i.e., filename and file size) will be hashed instead of the file contents if
quick = TRUE.
If set to
FALSE (default), the contents of the file(s) are hashed.
quick = TRUE,
length is ignored.
Raster objects are treated
as paths, if they are file-backed.
Optional list. This will pass into
specific classes. Should be options that the
.robustDigest knows what
to do with.
This method strips out stuff from a
simList class object that would make it otherwise not
reproducibly digestible between sessions, operating systems, or machines.
This will likely still not allow identical digest results across R versions.