Verify (and optionally write) checksums for data files in a module's data/ subdirectory. The file data/CHECKSUMS.txt contains the expected checksums for each data file. Checksums are computed using SpaDES.core:::.digest, which is simply a wrapper around digest::digest.

checksums(module, path, write, quickCheck = FALSE,
  checksumFile = file.path(path, "CHECKSUMS.txt"), ...)

# S4 method for character,character,logical
checksums(module, path, write,
  quickCheck = FALSE, checksumFile = file.path(path, "CHECKSUMS.txt"), ...)

# S4 method for character,character,missing
checksums(module, path, write,
  quickCheck = FALSE, checksumFile = file.path(path, "CHECKSUMS.txt"), ...)



Character string giving the name of the module.


Character string giving the path to the module directory.


Logical indicating whether to overwrite CHECKSUMS.txt. Default is FALSE, as users should not change this file. Module developers should write this file prior to distributing their module code, and update accordingly when the data change.


Logical. If TRUE, then the check with local data will only use file.size instead of digest::digest. This is faster, but potentially much less robust.


The filename of the checksums file to read or write to. The default is CHECKSUMS.txt located at file.path(path, module, "data", checksumFile). It is likely not a good idea to change this, and should only be used in cases such as Cache, which can evaluate if the checksumFile has changed.


Passed to digest, notably algo, so the digest algorithm can be specified.


A data.frame with columns: result, expectedFile, actualFile, and checksum.


Modules may require data that for various reasons cannot be distributed with the module source code. In these cases, the module developer should ensure that the module downloads and extracts the data required. It is useful to not only check that the data files exist locally but that their checksums match those expected. See also downloadData.


In version 1.2.0 and earlier, two checksums per file were required because of differences in the checksum hash values on Windows and Unix-like platforms. Recent versions use a different (faster) algorithm and only require one checksum value per file. To update your CHECKSUMS.txt files using the new algorithm, see


moduleName <- "my_module"
modulePath <- file.path("path", "to", "modules")

## verify checksums of all data files
checksums(moduleName, modulePath)

## write new CHECKSUMS.txt file

# 1. verify that all data files are present (and no extra files are present)
list.files(file.path(modulePath, moduleName, "data"))

# 2. calculate file checksums and write to file (this will overwrite CHECKSUMS.txt)
checksums(moduleName, modulePath, write = TRUE)
# }# NOT RUN {
# }