Tidystudy will help researchers see what happens to their study data between collection and analysis. This package is its first implementation. It will record every value of a study with its own hash and show what changed between the raw data and the analysis file. It works with tables that have one row per case and one column per variable, and surveys will be the first source.
The package is an early prototype without functions for users, so do not use it with real study data.
The package implements version 0 of the record format as internal functions and passes all of its test vectors.
| File | Content | Section of the specification |
|---|---|---|
R/bytes.R |
SHA-256, hexadecimal text, UTF-8 bytes | 1 |
R/leaf.R |
leaf input and leaf hash of a cell | 3 |
R/tree.R |
root hash of a list of leaf hashes | 4 |
R/order.R |
order of new cells within a fetch | 5, step 3 |
R/record.R |
a record in memory: recording a fetch, its state, withdrawal | 5 and 7 |
R/random.R |
random values from OpenSSL's generator, seeded by the operating system | 3 |
R/part.R |
the check of a part | 6 and 8 |
None of these functions reads files or uses the network. The package cannot yet fetch from a survey tool, import a file, save a record, write a part, write the log, request timestamps or compare an analysis file.
The package refuses a fetch that delivers a case that was withdrawn. The specification does not cover this case yet.
Speed has not been a goal so far. Recording 20,000 new cells takes about 4 seconds, and the root hash of 500,000 leaves takes about 15 seconds.
With R 4.5.0 or later and the packages testthat, jsonlite, pkgload and openssl:
testthat::test_local()Without R, use Docker:
docker build -t tidystudy-r-dev dev
docker run --rm -v "${PWD}:/pkg" tidystudy-r-dev Rscript -e "testthat::test_local()"
docker run --rm -v "${PWD}:/pkg" tidystudy-r-dev bash dev/check.shThe last command runs R CMD check.
dev/README.md describes how the package is developed: the tests, the test vectors and the continuous integration.
Apache-2.0. See LICENSE.md.